# Value mapping - Combine data from multiple indexes : plugin needed?

**URL:** <https://discuss.elastic.co/t/value-mapping-combine-data-from-multiple-indexes-plugin-needed/53527>\
**Category:** Elasticsearch\
**Created:** [June 21, 2016, 3:36pm UTC](https://discuss.elastic.co/t/value-mapping-combine-data-from-multiple-indexes-plugin-needed/53527 "2016-06-21T15:36:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptrussart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ptrussart/32/25648_2.png) [@ptrussart](https://discuss.elastic.co/u/ptrussart)\
**Post date:** [June 21, 2016, 3:36pm UTC](https://discuss.elastic.co/t/value-mapping-combine-data-from-multiple-indexes-plugin-needed/53527/1 "2016-06-21T15:36:19Z")

</div>

Hello,

I'm working on an app which is based on ES. We are using version 2.3 now.

In my app, I need to support multi-language. I know that the "classic" way to do that with ES will be to store the localized labels directly on each entry but here I would not want to store the multi-languages label on each entry.  
I will have a large amount of items in my base and those labels can be updated often so I would like to avoid updating all the entries every time there is a change in a label.

Here is what I would like to do :

In my ES repository, I have items, in the items index which are defined like this  
{"item\_name" : "Item #1", "item\_code": "code1", "item\_ref": "ref1"},  
{"item\_name" : "Item #2", "item\_code": "code2", "item\_ref": "ref2"},  
{"item\_name" : "Item #3", "item\_code": "code3", "item\_ref": "ref3"}

I have another index, data\_values which is defined like this :  
{"name" : "code", "key": "code1", "en": "One", fr:"Un", "es":"Uno"},  
{"name" : "code", "key": "code2", "en": "Two", fr:"Deux", "es":"Dos"},  
{"name" : "code", "key": "code3", "en": "Three", fr:"Trois", "es":"Tres"}

When I retrieve my items, I would like to have some kind of value mapping between my item properties and the data values. This way, I will be able to retrieve directly the labels to display them but also to sort my items based on their label (not on the value).

My idea is to develop a plugin with a custom action "\_localized\_search" that will retrieve the \_search results and apply the mapping on it.  
Do you guys think this is a good approach ? Is there a simpler way to achieve this ?

I'm starting to work on the ES plugin framework so any help will be welcomed.

Thank you.

---

<div class="post-metadata">

**Author:** ![ptrussart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ptrussart/32/25648_2.png) [@ptrussart](https://discuss.elastic.co/u/ptrussart)\
**Post date:** [June 22, 2016, 8:40am UTC](https://discuss.elastic.co/t/value-mapping-combine-data-from-multiple-indexes-plugin-needed/53527/2 "2016-06-22T08:40:41Z")

</div>

Does anyone have an input on this topic ? I'm starting to wondering if that's the good approach.

---

<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:** [July 5, 2017, 10:41pm UTC](https://discuss.elastic.co/t/value-mapping-combine-data-from-multiple-indexes-plugin-needed/53527/3 "2017-07-05T22:41:28Z")

</div>


