Could you help me with ElasticSearch suggesting: https://www.elastic.co/guide/en/elasticsearch/reference/5.1/search-suggesters-completion.html
- I've created type in ES index
curl -XPUT 'localhost:9200/tass_suggest_test/_mapping/company?pretty' -H 'Content-Type: application/json' -d'
{
"company": {
"properties": {
"id": {
"type": "integer"
},
"inn": {
"type": "keyword"
},
"innSuggest" : {
"type" : "completion"
}
}
}
}
'
Filled it with some amount of data
- Now I'm try to get data
curl -XGET 'http://localhost:9200/tass_suggest_test/company/_search?pretty' -d'
{
"from" : 0, "size" : 1,
"query" : {
"wildcard" : { "inn" : "78200*" }
}
}'
It's ok, I got some data:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
{
"_index" : "tass_suggest_test",
"_type" : "company",
"_id" : "23515589",
"_score" : 1.0,
"_source" : {
"id" : 23515589,
"inn" : "7820056885",
"innSuggest" : "7820056885"
}
}
]
}
}
But when I'm trying suggest query I got nothing
curl -XGET 'localhost:9200/tass_suggest_test/_suggest?pretty' -H 'Content-Type: application/json' -d'
{
"company-suggest" : {
"prefix" : "78200",
"completion" : {
"field" : "innSuggest"
}
}
}
'
{
"_shards" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
"company-suggest" : [
{
"text" : "7820056885",
"offset" : 0,
"length" : 10,
"options" : [ ]
}
]
}
Where is my fault?