我不知道ConstantScoreQuery如何運作關於Elasticsearch 1.4性能ConstantScoreQuery在elasticsearch
一個簡單的查詢有這樣如果你做一個計算得分(我不認爲太多1.0和2.0有關本之間改變)像這樣的查詢:
{
"constant_score":
"match": {"field":"text"}
}
它顯然比沒有constant_score更快。
現在,如果你正在做一個boolQuery,將boolQuery與constant_score包裝或包裝每個must/should/must_not子句是否有區別? exemples:
{
"constant_score": {
"bool":{
"must": [
{"match": {"field1": "text1"}},
{"match": {"field2": "text2"}}
]
}
}
}
與
{
"bool":{
"must": [
{"constant_score": {"match": {"field1": "text1"}}},
{"constant_score": {"match": {"field2": "text2"}}}
]
}
}
另外一個,當你用2"should"
案件一個boolFilter,默認情況下"minimum_should_match"
設置爲1,如果第一種測試情況確定它不麻煩去檢查另一個。
通過查詢,得分很重要,因此每個"should"
都經過測試,並加起來得分。有沒有一種方法與constant_score包裝一個布爾查詢,使其成爲一個簡單的「OR」布爾就像上面的過濾器?通過這個我的意思是不檢查每個文件上的每個"should"
。
感謝您的見解:)