elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
68.96k stars 24.49k forks source link

Introduce first query #52482

Open mayya-sharipova opened 4 years ago

mayya-sharipova commented 4 years ago

This is related to #42811 – deprecation of the function_score query. funciton_score query had a unique functionality – first, that is not present in the current query DSL.

A proposal is to implement this functionality through a dedicated query type.
This query evaluates the child queries in order, and for a document returns the score of the first matching query.

{
  "query": {
    "first": {
      "queries": [
        {
          "match": {"message": "elasticsearch"}
        },
        {
         "match": {"author": "kibana"}
        }
      ]
    }
  }
}

Other name proposals:

elasticmachine commented 4 years ago

Pinging @elastic/es-search (:Search/Search)

mayya-sharipova commented 2 years ago

Relates to https://github.com/elastic/elasticsearch/issues/49761 but addresses in for more general use cases where filters can't be expressed through script.

elasticsearchmachine commented 1 month ago

Pinging @elastic/es-search (Team:Search)

elasticsearchmachine commented 1 month ago

Pinging @elastic/es-search-relevance (Team:Search Relevance)