Skip to content

Instantly share code, notes, and snippets.

@un1t
Created January 11, 2017 08:55
Show Gist options
  • Save un1t/724cd26a407cac4ad40991915a4350fe to your computer and use it in GitHub Desktop.
Save un1t/724cd26a407cac4ad40991915a4350fe to your computer and use it in GitHub Desktop.
# curl -XDELETE 'http://localhost:9200/test'
curl -XPUT 'http://localhost:9200/test' -d '
{
"analysis": {
"char_filter": {
"my_charfilter": {
"type": "mapping",
"mappings": ["Ё=>Е", "ё=>е"]
}
},
"analyzer": {
"default_index": {
"type": "custom",
"char_filter": ["my_charfilter"],
"tokenizer": "standard",
"filter": ["lowercase", "russian_morphology", "my_stopwords"]
},
"default_search": {
"type": "custom",
"char_filter": ["my_charfilter"],
"tokenizer": "standard",
"filter": ["lowercase", "russian_morphology", "my_stopwords"]
},
"lower_keyword": {
"type": "custom",
"tokenizer": "keyword",
"filter": "lowercase"
}
},
"filter": {
"my_stopwords": {
"type": "stop",
"stopwords": "а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я"
}
}
}
}
'
curl -XPUT 'http://localhost:9200/_bulk?pretty' -d '
{ "index" : { "_index" : "test", "_type" : "publication", "_id" : "1" } }
{ "name" : "Роза"}
{ "index" : { "_index" : "test", "_type" : "publication", "_id" : "2" } }
{ "name" : "Липестки роз"}
{ "index" : { "_index" : "test", "_type" : "publication", "_id" : "3" } }
{ "name" : "Роза 150 см"}
{ "index" : { "_index" : "test", "_type" : "publication", "_id" : "4" } }
{ "name" : "Роза 130 см"}
{ "index" : { "_index" : "test", "_type" : "publication", "_id" : "5" } }
{ "name" : "Роза 50 см"}
{ "index" : { "_index" : "test", "_type" : "publication", "_id" : "6" } }
{ "name" : "Роза 30 см"}
'
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{"query": {"match": {"name": "роза"}}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment