how can i match a json list?

It might be that item is of nested type and if that’s the case, you need to query with a nested query like this:

{
  "query": {
    "bool": {
      "filter": {
        "nested": {
          "path": "item",
          "query": {
            "term": {
              "item.brand": "edf"
            }
          }
        }
      }
    }
  }
}

UPDATE:

According to the error you get, item.categories is not nested, so your initial query was right. However, you should use match instead of term, like this:

{
  "query": {
    "bool": {
      "filter": {
        "match": {
          "item.categories.description.en": "Bun"
        }
      }
    }
  }
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top