# How to limit the list of fields that can be written to a specific index?

**URL:** <https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401>\
**Category:** Elasticsearch\
**Created:** [August 8, 2019, 10:33am UTC](https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401 "2019-08-08T10:33:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melok](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Melok](https://discuss.elastic.co/u/Melok)\
**Post date:** [August 8, 2019, 10:33am UTC](https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401/1 "2019-08-08T10:33:08Z")

</div>

I want my document index to contain only fields ('a', 'b', 'c' for example). How can I do this?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 9, 2019, 5:54am UTC](https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401/2 "2019-08-09T05:54:23Z")

</div>

configure your mapping for these three fields and set the `dynamic` parameter in the mapping to `strict`. See [https://www.elastic.co/guide/en/elasticsearch/reference/7.3/dynamic.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/dynamic.html)

---

<div class="post-metadata">

**Author:** ![Melok](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Melok](https://discuss.elastic.co/u/Melok)\
**Post date:** [August 9, 2019, 7:52am UTC](https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401/3 "2019-08-09T07:52:35Z")

</div>

Thank you so much!

---

<div class="post-metadata">

**Author:** ![Melok](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Melok](https://discuss.elastic.co/u/Melok)\
**Post date:** [August 9, 2019, 8:37am UTC](https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401/4 "2019-08-09T08:37:35Z")

</div>

I took an example of creating an index from your link but got this error : java.lang.Boolean cannot be cast to java.util.Map

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/3/13dc3a64412d8845f597021667a8ea566bcba5b5.png)

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 9, 2019, 9:24am UTC](https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401/5 "2019-08-09T09:24:12Z")

</div>

please do not use screenshots, but use markdown to properly format code snippets, so other people can copy & paste them for testing.

Also add the version of Elasticsearch you are using.

---

<div class="post-metadata">

**Author:** ![Melok](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Melok](https://discuss.elastic.co/u/Melok)\
**Post date:** [August 9, 2019, 9:36am UTC](https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401/6 "2019-08-09T09:36:37Z")

</div>

6.8.0

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 12, 2019, 7:46am UTC](https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401/7 "2019-08-12T07:46:52Z")

</div>

can you try specifying a type like `_doc` in the mapping? Also, if you provide the code as a snippet, people will be able to reproduce locally by copy & paste. Noone will type your code sample from your image though.

---

<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 9, 2019, 7:47am UTC](https://discuss.elastic.co/t/how-to-limit-the-list-of-fields-that-can-be-written-to-a-specific-index/194401/8 "2019-09-09T07:47:00Z")

</div>

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