# Add field with same value for all docs in the index

**URL:** <https://discuss.elastic.co/t/add-field-with-same-value-for-all-docs-in-the-index/327880>\
**Category:** Elasticsearch\
**Created:** [March 16, 2023, 8:25pm UTC](https://discuss.elastic.co/t/add-field-with-same-value-for-all-docs-in-the-index/327880 "2023-03-16T20:25:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fzar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fzar/32/86117_2.png) [@fzar](https://discuss.elastic.co/u/fzar)\
**Post date:** [March 16, 2023, 8:25pm UTC](https://discuss.elastic.co/t/add-field-with-same-value-for-all-docs-in-the-index/327880/1 "2023-03-16T20:25:01Z")

</div>

Hello, I am writing to ask you about a question regarding the correct approach to take in these cases.

We have reports that have a country by default (it is defined when the report is defined) and we have an index that is associated with the report and has a previously defined mapping that is used when the index is created.

I want to start indexing the country within the index and then use it to do aggregations. The issue is that since the country is the same for all the documents, I have some questions that I wanted to ask here:

What would be the best way to add the country since it is always the same for all documents? At the index level? Each index shares the same mapping, but I the country can know it before creating the index.

In case it can be created at the index level, does it support aggregations afterwards? Because finally I'm going to make that field for that.

Thanks in advance!

---

<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:** [April 13, 2023, 8:25pm UTC](https://discuss.elastic.co/t/add-field-with-same-value-for-all-docs-in-the-index/327880/2 "2023-04-13T20:25:27Z")

</div>

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