# Add Field on the fly to the returned result

**URL:** <https://discuss.elastic.co/t/add-field-on-the-fly-to-the-returned-result/226361>\
**Category:** Elasticsearch\
**Created:** [April 3, 2020, 7:57am UTC](https://discuss.elastic.co/t/add-field-on-the-fly-to-the-returned-result/226361 "2020-04-03T07:57:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![keshara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keshara/32/63979_2.png) [@keshara](https://discuss.elastic.co/u/keshara)\
**Post date:** [April 3, 2020, 7:57am UTC](https://discuss.elastic.co/t/add-field-on-the-fly-to-the-returned-result/226361/1 "2020-04-03T07:57:58Z")

</div>

Hi,

Think about a elasticsearch query result where i get two matched documents in two buckets as below.

bucket1 =\>

```
{
"product": "abc",
"price: "$100"
}

```

bucket2 =\>

```
{
"product": "xyz",
"price": "$50"
}

```

now my requirement is that when it return these two buckets, is it possible to append a new FILED to the first bucket from same information that is found on the second bucket. So for example, new result from the elasticsearch would be;

bucket1 =\>

```
{
"product": "abc",
"price: "$100",
"other similar product prices": "$50"
}

```

bucket2 =\>

```
{
"product": "xyz",
"price": "$50"
}
```

---

<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:** [May 1, 2020, 7:58am UTC](https://discuss.elastic.co/t/add-field-on-the-fly-to-the-returned-result/226361/2 "2020-05-01T07:58:01Z")

</div>

Closed on May 1, 2020, 7:58am UTC

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