How to query multiple parameters in a nested field in elasticsearch

I'm trying to search for keyword and then add nested queries for amenities which is a nested field of an array of objects.

With the query below I am able to search when I'm only matching one amenity id but when I have more than one it doesn't return anything.

Anyone have an idea what is wrong with my query ?

{
  "sort": [
    {
      "_score": {
        "order": "desc"
      }
    },
    {
      "_geo_distance": {
        "geolocation": [
          100,
          10
        ],
        "order": "asc",
        "unit": "m",
        "mode": "min",
        "distance_type": "sloppy_arc"
      }
    }
  ],
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "fields": [
              "name^2",
              "city",
              "state",
              "zip"
            ],
            "fuzziness": 5,
            "query": "complete"
          }
        },
        {
          "nested": {
            "path": "amenities",
            "query": {
              "bool": {
                "must": [
                  {
                    "term": {
                      "amenities.id": "1"
                    }
                  },
                  {
                    "term": {
                      "amenities.id": "2"
                    }
                  }
                ]
              }
            }
          }
        }
      ]
    }
  }
}

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