ElasticsearchDSL icon indicating copy to clipboard operation
ElasticsearchDSL copied to clipboard

Some queries should support multiple fields

Open mvar opened this issue 9 years ago • 3 comments

I have tested range query and found out that it works with multiple fields (tested with ES 2.1.1). This library does not support that.

Example:

{
    "range": {
        "price": {
            "gt": 50
        },
        "title": {
            "gt": "ccc"
        }
    }
}

Currently if you want to achieve something like that using our library you need to create two range queries and put them into bool.

We should check how many queries support multiple fields and think how we could add support for it.

Edit: prefix and regexp queries also supports multiple fields (tested on ES 2.1.1).

mvar avatar Dec 21 '15 10:12 mvar

Hi @mvar , I've been checking out these and some other queries on this functionality and in reality it seems that there are quite a few queries that can accept multiple fields, however, that does not mean that they work correctly with them. My tests show that if multiple fields are provided to these queries the results will come out only for the last field that was specified, that is if i would have such a query:

{
  "query": {
    "range": {
      "age": {
        "gte": 30,
        "lte": 40
      },
      "price": {
        "gte": 10,
        "lte": 30
      }
    }
  }
}

I would only get results for price and the age field would be ignored.

einorler avatar Jul 22 '16 07:07 einorler

@einorler I think in such case you should open issue in Elasticsearch repository.

mvar avatar Jul 22 '16 07:07 mvar

https://github.com/elastic/elasticsearch/issues/19547

einorler avatar Jul 22 '16 08:07 einorler