Get the exact match value


(Jyoti Shukla) #1

Hi,I wanted to know how to get the exact matched documents as I am getting approximate value matching ,like I have written query:
{
"query": {
"nested": {
"path": "Trips",
"query": {
"bool": {
"must": [
{
"term": {
"Trips.Employees.Source_Geocode": "17.328375,78.587532"
}
},
{
"term": {
"Trips.Employees.Source_Geocode": "17.329349,78.595693"
}
}
]
}
}
}
}
}

but I am also getting value for 17.4523... like that.


(Alexander Reelsen) #2

is geocode a geo point? or a string? or a number array? What kind of field is this? Is it sufficient to just create a keyword field (which does not make much sense for any other kind of query like a range query). And what resembles an exact query/result set? If you had a couple of example documents (including mapping) this might be easier to follow and others are able to create a full reproduction.


(Jyoti Shukla) #3

For now ,it is string.And for exact search means I want value which I have given to match .If it is not clear,let me know.Bdw ,thanks for the reply.


(Alexander Reelsen) #4

See my answer above. You can use a keyword field in the mapping for exact string matching and use a term filter.


(Jyoti Shukla) #5

I used keyword ,still not getting the exact value.


(Alexander Reelsen) #6

If you dont share a full reproduction, it is basically impossible to help.

See https://www.elastic.co/help


(system) #7

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