Skip to content

Bool Filter problem in 0.19: [filtered] query does not support [should]  #1829

@skade

Description

@skade

Hi,

i have the following (sample) query:

{
  "query": {
    "filtered": {
      "query": {
        "match_all": {
        }
      },
      "filter": {
        "bool": {
          "must": {
            "term": {
              "user": {
                "value": "kimchy"
              }
            }
          },
          "must_not": {
            "range": {
              "age": {
                "from": 10,
                "to": 20
              }
            }
          },
          "should": [
            {
              "term": {
                "tag": {
                  "value": "wow"
                }
              }
            },
            {
              "term": {
                "tag": {
                  "value": "elasticsearch"
                }
              }
            }
          ]
        }
      }
    }
  }
}

When I run it against Elasticsearch 0.19.1, I get the following message:

$ curl -XPOST localhost:9200/test
$ curl -XPOST localhost:9200/_all/_search -d @query.json
... long output
nested: QueryParsingException[[test] [filtered] query does not support [should]]; }]","status":500}

When I change the term queries to their simpler form, it works:

{
  "query": {
    "filtered": {
      "query": {
        "match_all": {
        }
      },
      "filter": {
        "bool": {
          "must": {
            "term": {
              "user": "kimchy"
            }
          },
          "must_not": {
            "range": {
              "age": {
                "from": 10,
                "to": 20
              }
            }
          },
          "should": [
            {
              "term": {
                "tag": "wow"
              }
            },
            {
              "term": {
                "tag": "elasticsearch"
              }
            }
          ]
        }
      }
    }
  }
}

Both forms work against 0.18.7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions