Exact match not working with fields having space


(Vishnu P S) #1

I have a set of data loaded in elasticsearch. I ran the below query.
GET /xxxxxxx/_search
{
"query": {
"bool": {
"filter":[{"term":{"title": "Product order details" }}]}}
}

And it returns

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

But in elastic search there is an exact match for field "title" is present. Can someone help me on this.


(David Pilato) #2

Depends on analyzer used.
If you are using the default mapping, try the same query against title.keyword instead.


(Vishnu P S) #3

This one worked, thank you :slight_smile:


(system) #4

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