X_content_parse_exception

Hi,
I get the x_content_parse_exception error with the next query.
"reason": "[10:13] [bool] unknown field [wildcard]"

without the "bool" section I get the error:
"reason": "unknown query [must_not]"

Any suggestions why?

{
    "size": 5000,
    "query": {
        "bool": {
            "must_not": {
                "exists": {
                    "field": "status"
                }
            },
            "wildcard": {
                "type": {
                    "value": "Activity_*"
                }
            }
        }
    }
}

Hey there @redk1te , boolean queries only support must, filter, should and must_not as top level parameters, each of which can hold one or more queries. You should use `one of these (depending on what you need for your use case) and include your wildcard query as a query underneath that clause.

Here's an example of what that would look like:

{
  "size": 5000,
  "query": {
    "bool": {
      "must_not": {
        "exists": {
          "field": "status"
        }
      },
      "must": [
        {
          "wildcard": {
            "type": {
              "value": "Activity_*"
            }
          }
        }
      ]
    }
  }
}

Hi Kathleen
That did the trick. Thank you for elaborating.
I keep having a hard time finding these rules in the standard Elasticsearch help pages. Especially about combining queries.
Is there any other place where I could have found this?

Thanks for the feedback @redk1te - in this particular case we have Boolean Query DSL documentation that provides examples, though the examples are intentionally pretty simple for illustrative sake (term queries).

If there is something that could be clearer, though, feedback is always appreciated to improve!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.