Elastic Search Nested Query with Nested Object Elastic Search Nested Query with Nested Object elasticsearch elasticsearch

Elastic Search Nested Query with Nested Object


Try this:

{  "query": {    "bool": {      "must": [        {          "match": {            "Main_ingredient.type": "Beef"          }        },        {          "range": {            "Main_ingredient.weight": {              "lte": 1000            }          }        },        {          "nested": {            "path": "Ingredients",            "query": {              "bool": {                "must": [                  {                    "match": {                      "Ingredients.name": "garlic"                    }                  },                  {                    "range": {                      "Ingredients.weight": {                        "lte": 400                      }                    }                  }                ]              }            }          }        },        {          "nested": {            "path": "Ingredients",            "query": {              "bool": {                "must": [                  {                    "match": {                      "Ingredients.name": "chilli powder"                    }                  },                  {                    "range": {                      "Ingredients.weight": {                        "lte": 400                      }                    }                  }                ]              }            }          }        }      ]    }  }}