# Adding a field dinamically to search results

**URL:** <https://discuss.elastic.co/t/adding-a-field-dinamically-to-search-results/19968>\
**Category:** Elasticsearch\
**Created:** [September 25, 2014, 4:33pm UTC](https://discuss.elastic.co/t/adding-a-field-dinamically-to-search-results/19968 "2014-09-25T16:33:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dani\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dani_castro/32/1050_2.png) [@Dani\_Castro](https://discuss.elastic.co/u/Dani_Castro)\
**Post date:** [September 25, 2014, 4:33pm UTC](https://discuss.elastic.co/t/adding-a-field-dinamically-to-search-results/19968/1 "2014-09-25T16:33:08Z")

</div>

Hi,

I am a newbie into ElasticSearch and I am trying to figure out how to  
achieve this:

In our Elastic Search Cluster we have documents like this:

{  
"hotel" : "Hilton Maldives",  
"location" : ...  
}'

and what we want to achive is that when we search in Elastic Search, it  
replies with this:

{  
"hotel" : "Hilton Maldives",  
"price" : 100$  
"location" : ...  
}'

this dynamic or synthetic field will come from an external service.

Of course, we can achieve this after the retrieval of all the hits of a  
search, but for us the performance is a must, and we would like to add this  
while the ES cluster is retrieving the items: that means for example, that  
with 100 documents on 4 shards, distributed in 4 servers, each server will  
add the "price" field to 25 documents (on an hypotetic match of the 100  
documents)

As I understand, we need to create a plugin for Elastic Search, but after  
two days looking where and how, I have not found any clear reference on how  
to do it.

I would really appreciate any suggestion or help to this.

Thanks in advance!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/58ea0a0f-2216-4de2-a196-3fa11c44a5bd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/58ea0a0f-2216-4de2-a196-3fa11c44a5bd%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Dani\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dani_castro/32/1050_2.png) [@Dani\_Castro](https://discuss.elastic.co/u/Dani_Castro)\
**Post date:** [September 26, 2014, 7:10am UTC](https://discuss.elastic.co/t/adding-a-field-dinamically-to-search-results/19968/2 "2014-09-26T07:10:32Z")

</div>

Nobody has faced something like this before? ☹

El jueves, 25 de septiembre de 2014 18:33:08 UTC+2, Dani Castro escribió:

> Hi,
> 
> I am a newbie into Elasticsearch and I am trying to figure out how to  
> achieve this:
> 
> In our Elastic Search Cluster we have documents like this:
> 
> {  
> "hotel" : "Hilton Maldives",  
> "location" : ...  
> }'
> 
> and what we want to achive is that when we search in Elastic Search, it  
> replies with this:
> 
> {  
> "hotel" : "Hilton Maldives",  
> "price" : 100$  
> "location" : ...  
> }'
> 
> this dynamic or synthetic field will come from an external service.
> 
> Of course, we can achieve this after the retrieval of all the hits of a  
> search, but for us the performance is a must, and we would like to add this  
> while the ES cluster is retrieving the items: that means for example, that  
> with 100 documents on 4 shards, distributed in 4 servers, each server will  
> add the "price" field to 25 documents (on an hypotetic match of the 100  
> documents)
> 
> As I understand, we need to create a plugin for Elastic Search, but after  
> two days looking where and how, I have not found any clear reference on how  
> to do it.
> 
> I would really appreciate any suggestion or help to this.
> 
> Thanks in advance!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b9b17199-447a-4146-b2ea-3481a60e4848%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b9b17199-447a-4146-b2ea-3481a60e4848%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:59am UTC](https://discuss.elastic.co/t/adding-a-field-dinamically-to-search-results/19968/3 "2017-07-06T00:59:47Z")

</div>


