# Loading documents in index with mappings defined

**URL:** <https://discuss.elastic.co/t/loading-documents-in-index-with-mappings-defined/124826>\
**Category:** Elasticsearch\
**Created:** [March 20, 2018, 4:52pm UTC](https://discuss.elastic.co/t/loading-documents-in-index-with-mappings-defined/124826 "2018-03-20T16:52:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manjit](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@Manjit](https://discuss.elastic.co/u/Manjit)\
**Post date:** [March 20, 2018, 4:52pm UTC](https://discuss.elastic.co/t/loading-documents-in-index-with-mappings-defined/124826/1 "2018-03-20T16:52:54Z")

</div>

I have about 500K documents, few hundred per day. I am using C# to read these from sql server and generate json for all records for given day and POST to \_bulk endpoint.  
If I do not define index and just start inserting, it was taking less than 1 second per day. But I need Custom analyzer on some fields, so I defined my index with settings and mappings. Now it was taking about 10 seconds per day (for same data). If I pre define Index with just 'settings', then there is no performance hit but as soon as I define 'mappings' before loading documents, it slows down. I tried removing custom analyzer also but still no effect.  
What can be probable cause of this?  
Thanks.

---

<div class="post-metadata">

**Author:** ![Manjit](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@Manjit](https://discuss.elastic.co/u/Manjit)\
**Post date:** [March 20, 2018, 5:27pm UTC](https://discuss.elastic.co/t/loading-documents-in-index-with-mappings-defined/124826/2 "2018-03-20T17:27:25Z")

</div>

My bad. Had typo in 'type' being used in code (from one defined in mappings). Fixed that and no performance issues.

---

<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 17, 2018, 5:27pm UTC](https://discuss.elastic.co/t/loading-documents-in-index-with-mappings-defined/124826/3 "2018-04-17T17:27:48Z")

</div>

Closed on April 17, 2018, 5:27pm UTC

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