Skip to content

Nested Sub-query does not generate correct elastic search syntax. #266

@vinay11283

Description

@vinay11283
bodybuilder()
	.query('term', 'field', 'something')
       .andQuery('bool', (q) => {
     	return q.query('term', 'obj1.color', 'blue')
  	})
        .build()

generates bool.query which is not valid as per ES
[bool] query does not support [query]

{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "field": "something"
          }
        },
        {
          "bool": {
            "query": {
              "term": {
                "obj1.color": "blue"
              }
            }
          }
        }
      ]
    }
  }
}

This is just simplistic scneario, I genuinely have some subqueries wiith nested path's as well which does not work. I can come up with better example if this does not make sense.

Please advise if there is a workaround I can apply ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions