0

I have the below set of documents. Is there a way to search for all document's that have the categories "61" and "64" (documents 1,2,3,5), no more or less?

  {"id": 1, "regions" : ["61", "64"]}
    {"id": 2, "regions" : ["61", "63", "64"]}
    {"id": 3, "regions" : ["67", "64", "61"]}
    {"id": 4, "regions" : ["61"]}
    {"id": 5, "regions" : ["61", "64"]}

Tnx in advance

1
  • Please do let me know if my answer works for you Jun 13, 2016 at 13:07

2 Answers 2

0

Try this:

{
  "query": {
    "match": {
      "regions": {
        "query": "61 64",
        "operator": "AND"
      }
    }
  }
}
0

Try this out,

curl -u uname:'pword' -XGET 'host:port/index/type/_search?' -d '

{
  "filter": {
    "and": [
      {
        "in": {
          "regions": [
            "61"
          ]
        }
      },
      {
        "in": {
          "regions": [
            "64"
          ]
        }
      }
    ]
  }
}'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.