Elasticsearch filter

I am trying to filter documents which has productid = 0 (type: String)
But I getting results which includes 10, 20,30 etc. I need only the ProductID =0 . I was referring the below URL . I tried this in sense.
How should i modify to just get documents with productid = 0?
GET /merge_14/data/_search
{
"query" : {
"constant_score" : {
"filter" : {
"term" : {
"productID" : 0
}
}
}
}
}

https://www.elastic.co/guide/en/elasticsearch/guide/current/_finding_exact_values.html

A filter that should work would be:

GET /merge_14/data/_search
{
  "query" : {
    "bool" : {
      "filter" : [
        {
          "term" : {
            "productID" : 0
          }
        }
      ]
    }
  }
}

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