0
votes

Does anyone know how to fix below query?

400: {"error":{"root_cause":[{"type":"parsing_exception","reason":"[someField1] query malformed, no start_object after query name","line":6,"col":22}],"type":"parsing_exception","reason":"[someField1] query malformed, no start_object after query name","line":6,"col":22},"status":400}

   {
      "query": {
        "bool": {
          "must": [
            {
              "someField1": true
            }
          ],
          "must_not": [
            {
              "exists": {
                "field": "someField2"
              }
            }
          ]
        }
      }
    }
1

1 Answers

3
votes

You're missing a query on testField1, it should be term or match:

{
  "query": {
    "bool": {
      "must": [
        {
          "term": {                   <--- add this 
             "someField1": true
          }
        }
      ],
      "must_not": [
        {
          "exists": {
            "field": "someField2"
          }
        }
      ]
    }
  }
}