Querystring search on array elements in Elastic Search

For that requirement to be achieved, you need to look at nested objects, not to query a flattened list of values but individual values from that nested object. For example:

{
  "mappings": {
    "people": {
      "properties": {
        "name": {
          "type": "string"
        },
        "quotations": {
          "type": "nested",
          "properties": {
            "value": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}

Values:

{"name":"Mr A","quotations":[{"value": "quotation one, this and that and these"}, {"value": "quotation two, those and that"}]}
{"name":"Mr B","quotations":[{"value": "quotation three, this and that"}, {"value": "quotation four, those and these"}]}

Query:

{
  "query": {
    "nested": {
      "path": "quotations",
      "query": {
        "bool": {
          "must": [
            { "match": {"quotations.value": "this"}},
            { "match": {"quotations.value": "these"}}
          ]
        }
      }
    }
  }
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)