Unable to search array values on filter

**This is my data**
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 6,
    "successful" : 6,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 2,
      "relation" : "eq"
    },
    "max_score" : 2.5176964,
    "hits" : [
      {
        "_index" : "test",
        "_id" : "_3oifinsfi3m",
        "_score" : 2.5176964,
        "_source" : {
          "id" : "2839u423u4298",
          "title" : "Test",
          "body" : "Testing",
          "uniqueID" : "aaa",
        }
      },
      {
        "_index" : "test",
        "_id" : "fsufsifhi2uh2ui",
        "_score" : 2.5176964,
        "_source" : {
          "id" : "sfknjn2knan",
          "title" : "Test",
          "body" : "Testing123",
          "uniqueID" : "bbb"        
}
      }
    ]
  }
}

**This is my query :** 

GET _search
{
          "query": {
            "bool" : {
              "must" : {
                "multi_match" : { 
                  "query": "Test",
                  "fields" : ["title","body"] 
                }
              },
              "filter": {
                "terms" : {  "uniqueID": ["aaa,vvv,bbb,ddd"]  }
              }
            }
          }
}

**This is the output I'm getting :** 

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 6,
    "successful" : 6,
    "skipped" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  }
}

The output is empty which should not be.

Can anybody help, i want to search a query for muliple fields and filter on one field which will be madatory the filtering on based of array values. I tried everything but not working.

Looks correct to me as you have listed a single large term with commas. What do you get if you instead run this?

GET _search
{
          "query": {
            "bool" : {
              "must" : {
                "multi_match" : { 
                  "query": "Test",
                  "fields" : ["title","body"] 
                }
              },
              "filter": {
                "terms" : {  "uniqueID": ["aaa", "vvv", "bbb", "ddd"]  }
              }
            }
          }
}

@Christian_Dahlqvist

I'm getting empty result

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 6,
    "successful" : 6,
    "skipped" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  }
}

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