elasticsearch - Elastic Search Document Boosting (like Solr elevateIds) -
looking move solr elastic search due amazon rest api , suitability clustering. struggling figure out way boost @ query time specific documents in solrs elevate method. there way , if examples helpful :)
i assume you're referencing solr queryelevationcomponent. https://wiki.apache.org/solr/queryelevationcomponent
there has been previous discussion on github how emulate functionality in elasticsearch. https://github.com/elasticsearch/elasticsearch/issues/1066
the idea use elasticsearch constant score query apply constant boost matching documents. apply big enough boost , in effect "sponsored search" result of solr's elevate.
from documentation:
constant score query
a query wraps filter or query , returns constant score equal query boost every document in filter. maps lucene constantscorequery.
{ "constant_score" : { "filter" : { "term" : { "user" : "kimchy"} }, "boost" : 1.2 } }
the filter object can hold filter elements, not queries. filters can faster compared queries since don’t perform scoring, when cached.
a query can wrapped in constant_score query:
{ "constant_score" : { "query" : { "term" : { "user" : "kimchy"} }, "boost" : 1.2 } }
edit
example using multiple boosts:
{ "query": { "bool": { "should": [{ "constant_score": { "filter": { "terms": { "user": ["kimchy", "john"] } }, boost: 3 } }, { "constant_score": { "filter": { "terms": { "user": ["paul", "ringo"] } }, boost: 2 } }] } } }
Comments
Post a Comment