List query must contain all elements

how about something this (on top of my head and untested, make sure you test some corner cases)?

PUT test/_doc/1
{
  "array": [
    "value1", 
    "value2",
    "value3",
    "value4"
  ]
}

PUT test/_doc/2?refresh
{
  "array": [
    "value1",
    "value2",
    "value4"
  ]
}

GET test/_search 
{
  "query": {
    "match": {
      "array": {
        "operator": "and",
        "query": "value1 value2 value3 value4"
      }
    }
  }
}
1 Like