ES Reverse Mapping


(Sachini Perera) #1

Is it possible to do a reverse mapping? Such as, in mapping, it manipulates the search string,
for Ex: "I'm delighted about it :(" is searched as "I'm delighted about it sad"

Here my search string is "digital"
I want _id: 2,3 to be appear in my exact match.

Search query:
{
"query": {
"match": {
"blah_related_names" : "digital"
}
}
}

How my index data looks like
{
"_index": "blah_blah_search_v99",
"_type": "blah_group",
"_id": "1",
"_score": 1,
"_source": {
"blah_name": "Travel",
"blah_related_names": "travel,tour,flights,traveler,digita",
}
},
{
"_index": "blah_blah_search_v99",
"_type": "blah_group",
"_id": "2",
"_score": 1,
"_source": {
"blah_name": "Computers",
"blah_related_names": "PC,lenovo,digita-l",
}
},
{
"_index": "blah_blah_search_v99",
"_type": "blah_group",
"_id": "3",
"_score": 1,
"_source": {
"blah_name": "Technolodgy",
"blah_related_names": "tech,digital",
}
},
}

My mapping array would look like the following
'&' => '',
'%' => ' ',
'-' => '',
'_' => ' ',
'\'' => '',
'é' => 'e',
'è' => 'e',
'ë' => 'e',


(Mark Walkom) #2

This is best handled with analysers, or by doing substitutions in your code before sending to Elasticsearch.


(Sachini Perera) #3

Thanks for the feedback.
I tried with the analysers and failed. So it is better to do the clean-up before storing data in the ES.


(system) #4

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