# Attach a label to ES query so that to distinguish between the multiple responses

**URL:** <https://discuss.elastic.co/t/attach-a-label-to-es-query-so-that-to-distinguish-between-the-multiple-responses/280683>\
**Category:** Elasticsearch\
**Created:** [August 6, 2021, 8:25pm UTC](https://discuss.elastic.co/t/attach-a-label-to-es-query-so-that-to-distinguish-between-the-multiple-responses/280683 "2021-08-06T20:25:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NLSVTN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nlsvtn/32/84889_2.png) [@NLSVTN](https://discuss.elastic.co/u/NLSVTN)\
**Post date:** [August 6, 2021, 8:25pm UTC](https://discuss.elastic.co/t/attach-a-label-to-es-query-so-that-to-distinguish-between-the-multiple-responses/280683/1 "2021-08-06T20:25:26Z")

</div>

Hi,

I am issuing multiple queries (MultiSearch in python Elasticsearch DSL) for ES index and I need a way to set a label 'type' (which could be one of several values) for each query, so that it would be present in the response and I would be able to differentiate between the responses. Just a string or a number would be enough, is it possible to do somehow?

---

<div class="post-metadata">

**Author:** ![Glen\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glen_smith/32/111656_2.png) [@Glen\_Smith](https://discuss.elastic.co/u/Glen_Smith)\
**Post date:** [August 6, 2021, 8:40pm UTC](https://discuss.elastic.co/t/attach-a-label-to-es-query-so-that-to-distinguish-between-the-multiple-responses/280683/2 "2021-08-06T20:40:58Z")

</div>

Provided you are using boolean queries, you can provide a term-by-term `_name` that will be included in your results.

> **[Boolean query | Elasticsearch Guide \[7.14\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.14/query-dsl-bool-query.html#named-queries)**

---

<div class="post-metadata">

**Author:** ![NLSVTN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nlsvtn/32/84889_2.png) [@NLSVTN](https://discuss.elastic.co/u/NLSVTN)\
**Post date:** [August 6, 2021, 8:42pm UTC](https://discuss.elastic.co/t/attach-a-label-to-es-query-so-that-to-distinguish-between-the-multiple-responses/280683/3 "2021-08-06T20:42:51Z")

</div>

I searched on Elasticsearch DSL page and I don't see how to do it there:

[https://elasticsearch-dsl.readthedocs.io/en/latest/search\_dsl.html](https://elasticsearch-dsl.readthedocs.io/en/latest/search_dsl.html)

I am thinking that maybe it is extra properties section, but not sure:

[https://elasticsearch-dsl.readthedocs.io/en/latest/search\_dsl.html#extra-properties-and-parameters](https://elasticsearch-dsl.readthedocs.io/en/latest/search_dsl.html#extra-properties-and-parameters)

---

<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:** [September 3, 2021, 8:43pm UTC](https://discuss.elastic.co/t/attach-a-label-to-es-query-so-that-to-distinguish-between-the-multiple-responses/280683/4 "2021-09-03T20:43:38Z")

</div>

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