# Alternative for mapping type

**URL:** <https://discuss.elastic.co/t/alternative-for-mapping-type/246972>\
**Category:** Elasticsearch\
**Created:** [August 31, 2020, 2:33pm UTC](https://discuss.elastic.co/t/alternative-for-mapping-type/246972 "2020-08-31T14:33:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nupur](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@Nupur](https://discuss.elastic.co/u/Nupur)\
**Post date:** [August 31, 2020, 2:33pm UTC](https://discuss.elastic.co/t/alternative-for-mapping-type/246972/1 "2020-08-31T14:33:18Z")

</div>

1. what is the best way to index data when i have two types .. and only one field in data is different based on the type. I have 4-5 fields for a single doc.
2. is it good to use single index or two indexes . each for a type .. same fields in both except one field.
3. does increasing indexes reduces performance ?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 31, 2020, 9:47pm UTC](https://discuss.elastic.co/t/alternative-for-mapping-type/246972/2 "2020-08-31T21:47:32Z")

</div>

Welcome to our community! 😃

Given the structures are pretty much the same, the best idea is to add a new field called `doc_type` with a value to differentiate between the two. If the document structures start to really diverge, then split into their own indices.

Shard counts matter more than the number of indices. So try to keep your shard counts low.

---

<div class="post-metadata">

**Author:** ![Nupur](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@Nupur](https://discuss.elastic.co/u/Nupur)\
**Post date:** [September 1, 2020, 5:24am UTC](https://discuss.elastic.co/t/alternative-for-mapping-type/246972/3 "2020-09-01T05:24:48Z")

</div>

Thank u so much ... based on the type can i put different analyzer on the field data?.. while searching and while indexing.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 1, 2020, 5:33am UTC](https://discuss.elastic.co/t/alternative-for-mapping-type/246972/4 "2020-09-01T05:33:53Z")

</div>

No you cannot. You would need to have different field names to handle that.

---

<div class="post-metadata">

**Author:** ![Nupur](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@Nupur](https://discuss.elastic.co/u/Nupur)\
**Post date:** [September 1, 2020, 5:52am UTC](https://discuss.elastic.co/t/alternative-for-mapping-type/246972/5 "2020-09-01T05:52:06Z")

</div>

okay thanks .. one more doubt .. querying through sql access api or querying through dsl .. which is faster . Is there is performance difference in both.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 1, 2020, 5:53am UTC](https://discuss.elastic.co/t/alternative-for-mapping-type/246972/6 "2020-09-01T05:53:22Z")

</div>

You're better off making a new topic for that question, it just makes it easier to track things 🙂

---

<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 29, 2020, 5:53am UTC](https://discuss.elastic.co/t/alternative-for-mapping-type/246972/7 "2020-09-29T05:53:49Z")

</div>

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