Hi Christoph Büscher,
Thank you for your reply.
The mappings in both the servers are exactly similar. Both uses similar YML file and uses filter Synonym. Both uses standard tokenizer.
{
"employeelocations": {
"settings": {
"index": {
"mappings": {
"location": {
"properties": {
"LocationDetails": {
"type": "string",
"analyzer": "synonym"
}
}
}
}
},
"number_of_shards": "5",
"creation_date": "1461061314247",
"analysis": {
"filter": {
"synonym": {
"ignore_case": "true",
"type": "synonym",
"synonyms": [
"pq=>port quarters",
"admin=>administration",
]
}
},
"analyzer": {
"synonym": {
"filter": [
"lowercase",
"synonym"
],
"tokenizer": "standard"
}
}
},
"number_of_replicas": "1",
"uuid": "S_aZYalAT1eYDUYiczUNqg",
"version": {
"created": "2010199"
}
}
}
}
}
Only difference which i see between both the environment is one is having 4k records (the one which returns me result with first letter of second word) and other one is having 1.9 lakh records.
The field (LocationDetails) which is showing the issue is actually a string field which can contain 3 or 4 words, For example
"The port way 21B Avenue mansion 320021"
This field when i search using the above mentioned query is returning different results in both servers. When i type "The Port Way", i see 10 records like
The port way 1 Avenue mansion 320021
The port way 1A Avenue mansion 320021
The port way 1B Avenue mansion 320021
The port way 1C Avenue mansion 320021
The port way 2 Avenue mansion 320021
The port way 2A Avenue mansion 320021
The port way 2B Avenue mansion 320021
The port way 2C Avenue mansion 320021
The port way 3 Avenue mansion 320021
The port way 3C Avenue mansion 320021
in both the servers.
Now i am typing 1 along with "The port way". So the query which i pass to search is
"The port way 1". This should actually filter the result set so that 4 records from above result set is matching and it should be returned. But that is not happening in one of the server. It sometimes return no records, sometimes it returns only one matching record, while the other server gives me exactly filtered 4 records.
I am bit confused as ES behaves differently in different servers. Please help or provide me best way to achieve this in case i am doing it wrong.
Requirement is actually user should be able to search this field and search results should filter properly when user keeps typing one letter after the other, so that only one record will exist in search result when user reaches till last letter.