Adding a field dynamically to search results

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!

链接地址: http://www.djcxy.com/p/60134.html

上一篇: Elastic Search中的字段属性

下一篇: 动态添加字段到搜索结果