elasticsearch - Elastic Search compound queries -
i make compound query in elastic search? query: co la
and search results return:
- coca cola 350ml
- diet coca cola 2l
- latin condom ultra soft
- cornstarch
- lard
assuming have index "food" , type "allproducts", how structure search?
thanks
complementing requests mapping index used this:
curl -xput 'localhost: 9200 / food / _settings' -d' { "index.analysis.analyzer.default.filter.0 ": "standard ", "index.analysis.analyzer.default.tokenizer ": "standard ", "index.analysis.analyzer.default.filter.1 ": "lowercase ", "index.analysis.analyzer.default.filter.2 ": "stop ", "index.analysis.analyzer.default.filter.3 ": "asciifolding " } '
example of current search using match_phrase_prefix, allows compound words have last sentence snippet.
this.clientelastic.search ({ index: 'food' type: 'allprodutcts', body: { "from": 0, "size": 50, query: { match_phrase_prefix: { nameproduct: event.srcelement.value, } } } }). (function (resp) { if (event.srcelement.value == "") { send search = null; } else { env.busca = resp.hits.hits; } }, function (err) { console.log (err.message); });
thanks again
Comments
Post a Comment