What is the difference between must and filter in Query DSL in elasticsearch?

后端 未结 1 1660
逝去的感伤
逝去的感伤 2020-12-25 10:25

I am new to elastic search and I am confused between must and filter. I want to perform an and operation between my terms, so I did this

POST /xyz/_search

1条回答
  •  借酒劲吻你
    2020-12-25 11:30

    must contributes to the score. In filter, the score of the query is ignored.

    In both must and filter, the clause(query) must appear in matching documents. This is the reason for getting same results.

    You may check this link

    Score

    The relevance score of each document is represented by a positive floating-point number called the _score. The higher the _score, the more relevant the document.

    A query clause generates a _score for each document.

    To know how score is calculated, refer this link

    0 讨论(0)
提交回复
热议问题