# Generating extra-fields to my results based on query

**URL:** <https://discuss.elastic.co/t/generating-extra-fields-to-my-results-based-on-query/211491>\
**Category:** Elasticsearch\
**Created:** [December 11, 2019, 3:52pm UTC](https://discuss.elastic.co/t/generating-extra-fields-to-my-results-based-on-query/211491 "2019-12-11T15:52:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ovinz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ovinz/32/59207_2.png) [@ovinz](https://discuss.elastic.co/u/ovinz)\
**Post date:** [December 11, 2019, 3:52pm UTC](https://discuss.elastic.co/t/generating-extra-fields-to-my-results-based-on-query/211491/1 "2019-12-11T15:52:45Z")

</div>

Hi everyone,

I’m discovering ElasticSearch and I really don’t know how to find this kind of feature in the ES documentation.  
My goal is to add extra-fields to the result of a query ; the extra-fields being themselves a response of another query.

For instance, I have Ads and I want to add an extra-field such as {car : true} if the Ad description contains the word "car".  
I guess it's possible as the Script Field feature almost do that.

Any idea ?  
Thanks for your clues

Ovinz

---

<div class="post-metadata">

**Author:** ![amrmostafazaki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amrmostafazaki/32/58456_2.png) [@amrmostafazaki](https://discuss.elastic.co/u/amrmostafazaki)\
**Post date:** [December 11, 2019, 11:36pm UTC](https://discuss.elastic.co/t/generating-extra-fields-to-my-results-based-on-query/211491/2 "2019-12-11T23:36:40Z")

</div>

Hello @ovinz

Take a look at the section [Creating a Scripted Field] section at this [doc](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html).

---

<div class="post-metadata">

**Author:** ![ovinz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ovinz/32/59207_2.png) [@ovinz](https://discuss.elastic.co/u/ovinz)\
**Post date:** [December 12, 2019, 10:56am UTC](https://discuss.elastic.co/t/generating-extra-fields-to-my-results-based-on-query/211491/3 "2019-12-12T10:56:35Z")

</div>

Hello @amrmostafazaki

Thanks for your response.

Indeed I'm pretty sure it's all about that, you're right, but do you know if I can do that with a Query ?  
To be clear, can I run a "match\_phrase" with fuzzy for typos, levenstein distance... instead of a "IndexOf" like this ?

[https://discuss.elastic.co/t/check-if-a-field-string-start-with-a-determinate-string/108612/2](https://discuss.elastic.co/t/check-if-a-field-string-start-with-a-determinate-string/108612/2)

Thanks again

Ovinz

---

<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:** [January 9, 2020, 10:56am UTC](https://discuss.elastic.co/t/generating-extra-fields-to-my-results-based-on-query/211491/4 "2020-01-09T10:56:35Z")

</div>

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