Hi guys, you know I have a problem with a query in "Terms" where the query is:
GET /user/_search
{
"query": {
"terms" : {
"user" : ["user-1"]
}
}
}
something so simple but it does not return anything. I put an example of index and response.
Mapper:
PUT /user/_doc/1
{
"user" : "user-1"
}
PUT /user/_doc/2
{
"user" : "user-2"
}
PUT /user/_doc/3
{
"user" : "user-3"
}
Query Failed:
GET /user/_search
{
"query": {
"terms" : {
"user" : ["user-1"]
}
}
}
Respose Failed:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
When removing "-" from terms, the result is returned but I need it to be exact, since it will be used for location queries where it must be exact, because if only "california" is indicated, it can return results from the US and California. Mexico.
Query Success:
GET /user/_search
{
"query": {
"terms" : {
"user" : ["1"]
}
}
}
Response Success:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
{
"_index" : "user",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"user" : "user-1"
}
}
]
}
}
I use Terms since you can specify several locations in the same query.
I hope you help me.
Greetings.