# ES Reverse Mapping

**URL:** <https://discuss.elastic.co/t/es-reverse-mapping/118042>\
**Category:** Elasticsearch\
**Created:** [February 1, 2018, 3:03pm UTC](https://discuss.elastic.co/t/es-reverse-mapping/118042 "2018-02-01T15:03:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sachini\_Perera](https://avatars.discourse-cdn.com/v4/letter/s/ee59a6/32.png) [@Sachini\_Perera](https://discuss.elastic.co/u/Sachini_Perera)\
**Post date:** [February 1, 2018, 3:03pm UTC](https://discuss.elastic.co/t/es-reverse-mapping/118042/1 "2018-02-01T15:03:12Z")

</div>

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',`

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 1, 2018, 8:39pm UTC](https://discuss.elastic.co/t/es-reverse-mapping/118042/2 "2018-02-01T20:39:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sachini\_Perera](https://avatars.discourse-cdn.com/v4/letter/s/ee59a6/32.png) [@Sachini\_Perera](https://discuss.elastic.co/u/Sachini_Perera)\
**Post date:** [February 2, 2018, 10:26am UTC](https://discuss.elastic.co/t/es-reverse-mapping/118042/3 "2018-02-02T10:26:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 2, 2018, 10:26am UTC](https://discuss.elastic.co/t/es-reverse-mapping/118042/4 "2018-03-02T10:26:15Z")

</div>

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