I have my elastic search data stored in the following format:
{
"person_name": "Abraham Benjamin deVilliers",
"name": "Abraham",
"office": {
"name": "my_office"
}
},
{
"person_name": "Johnny O'Ryan",
"name": "O'Ryan",
"office": {
"name": "Johnny O'Ryan"
}
},
......
And i have match query to search based on person_name
,name
and office.name
as follows:
{
"query": {
"multi_match" : {
"query": "O'Ryan",
"type": "best_fields",
"fields": [ "person_name", "name", "office.name" ],
"operator":"and"
}
}
}
And its working fine and i am getting expected result for query fields which are exactly matching the name
or person_name
or office.name
as below.
{
"person_name": "Johnny O'Ryan",
"name": "O'Ryan",
"office": {
"name": "Johnny O'Ryan"
}
}
Now i want to enable the search to return the same response when the user passes the query field ORyan
instead if O'Ryan
, ignoring the Single quote (')
from the stored result.
Is there is a way to do it while doing elastic search query or do i need to ignore the special characters while storing the data in elastic search ?.
Any help will be appreciated.