# How to identify which fields are used/unused when using \_default\_ and dynamic mapping

**URL:** https://discuss.elastic.co/t/how-to-identify-which-fields-are-used-unused-when-using--default--and-dynamic-mapping/39600
**Category:** Elasticsearch
**Created:** [January 19, 2016, 9:27pm UTC](https://discuss.elastic.co/t/how-to-identify-which-fields-are-used-unused-when-using--default--and-dynamic-mapping/39600 "2016-01-19T21:27:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![unknownunknown](https://avatars.discourse-cdn.com/v4/letter/u/4da419/32.png) [@unknownunknown](https://discuss.elastic.co/u/unknownunknown)
#### Post date: [January 19, 2016, 9:27pm UTC](https://discuss.elastic.co/t/how-to-identify-which-fields-are-used-unused-when-using--default--and-dynamic-mapping/39600/1 "2016-01-19T21:27:07Z")

</div>

Elasticsearch 1.7.3 behavior.

Suppose I am using a _default_ mapping and various types. My _default_ mapping is a superset of my types fields, so, something like:

```
_default_: {
  properties: {
     "a": { "type": "string" },
     "b":{"type":"string"},
     ... etc
  }
}

```

If I understand correctly, when I create an index using this default mapping and a type A which uses field a, a new type gets dynamically created called A.

When I retrieve the mappings for this index and type, I become surprised when I see all the fields defined in _default_ in the mappings for index/A.

I'm going to index a bunch of these, with several different types and about a hundred fields, with many tens of thousands of these event per second. I assume I want a fixed mapping for performance reasons.

Is there a way to find out which fields are actually in use (and/or are unused) so I can define a fixed mapping for type A? Is there any reason trying to do this violates certain philosophies of ES?

Thanks for any help.

---

<div class="post-metadata">

### Author: ![abeyad](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@abeyad](https://discuss.elastic.co/u/abeyad)
#### Post date: [January 21, 2016, 2:51am UTC](https://discuss.elastic.co/t/how-to-identify-which-fields-are-used-unused-when-using--default--and-dynamic-mapping/39600/2 "2016-01-21T02:51:19Z")

</div>

All entries in the `_default_` mapping are applied to every type in the index. If the `_default_` mapping contains all the different fields that can occur in your documents, could your document model just have one type in which all the documents go in? Alternatively, I'm not sure of the nature of your data, but you could possibly take advantage of dynamic mapping: [https://www.elastic.co/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)

There are no APIs to retrieve which fields are in use for a given index.

---

<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: [July 5, 2017, 11:22pm UTC](https://discuss.elastic.co/t/how-to-identify-which-fields-are-used-unused-when-using--default--and-dynamic-mapping/39600/3 "2017-07-05T23:22:46Z")

</div>


