Term query can't not apply to "id" field?


(Cherry Zhang) #1

when I use below query, no result return:

{
  "query" : {
    "term" : {
      "id" : {
        "value" : "abcdef",
        "boost" : 1.0
      }
    }
  },
  "ext" : { }
}

but when I use ids query, the return result is fine:

{
    "query": {
        "ids" : {
            "type" : "trip",
            "values" : ["abcdef"]
        }
    }
}

My questions are: term query can't not apply to "id" field? Must I use ids query? Is there a better way to search an id in multiple indices?


(Alexander Reelsen) #2

Hey,

id just refers to a field named id inside of your document JSON. I guess you want to query the _id field.

--Alex


(Cherry Zhang) #3

That's true. Thanks for helping.


(system) #4

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