performance - ConstantScoreQuery in elasticsearch -
i'm not sure how constantscorequery works regarding performance in elasticsearch 1.4 (i don't think changed between 1.0 , 2.0 regarding this)
a simple query has calculate score if query :
{ "constant_score": "match": {"field":"text"} }
it's faster without constant_score.
now if doing boolquery, there difference between wrapping boolquery constant_score or wrapping every must/should/must_not clause ? exemples :
{ "constant_score": { "bool":{ "must": [ {"match": {"field1": "text1"}}, {"match": {"field2": "text2"}} ] } } }
versus
{ "bool":{ "must": [ {"constant_score": {"match": {"field1": "text1"}}}, {"constant_score": {"match": {"field2": "text2"}}} ] } }
another one, when boolfilter 2 "should"
cases, default "minimum_should_match"
set 1 , if first tested case ok doesn't bother check other.
with queries, score important each "should"
tested , adds score of hit. there way constant_score wrapping bool query make simple "or" bool above filter ? mean not checking every "should"
on each document.
thanks insights :)
i tested on local elasticsearch (1.4.4)
it turns out if wrap constant_score around bool query shoulds doesn't behave boolfilter, returns every document. minimum should match mandatory.
about using constant_score on bool query or on each part, return same, every result has same score still don't know if computed before , set constant one...
Comments
Post a Comment