I am trying to search for an exact match string but ES does not give me expected results.
Below is the example -
Here is index creation -
POST /spacetesting1
{
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"couchbaseDocument" : {
"_source" : { "enabled" : false },
"properties" : {
"name" : { "type" : "string", "index" : "not_analyzed" }
}
}
}
}
Below are the 2 documents I inserted to the index -
PUT /spacetesting1/CouchbaseDocument/7
{
"name": "new york"
}
PUT /spacetesting1/CouchbaseDocument/8
{
"name": "new York company"
}
When I search for a word 'new york', ES gives me 2 documents as above. But I am expecting only one that is exact match with 'new york'.
Can someone guide me on how to get exact match from ES?
Thanks in advance.
Regard, Sameer
答案 0 :(得分:2)
Seems it is a case issue. In mapping you gave 'couchbaseDocument' and while indexing he gave CouchbaseDocument.