# Indexing Speed Elastic Search

**URL:** <https://discuss.elastic.co/t/indexing-speed-elastic-search/71595>\
**Category:** Elasticsearch\
**Created:** [January 14, 2017, 4:43am UTC](https://discuss.elastic.co/t/indexing-speed-elastic-search/71595 "2017-01-14T04:43:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmandke](https://avatars.discourse-cdn.com/v4/letter/v/a9adbd/32.png) [@vmandke](https://discuss.elastic.co/u/vmandke)\
**Post date:** [January 14, 2017, 4:43am UTC](https://discuss.elastic.co/t/indexing-speed-elastic-search/71595/1 "2017-01-14T04:43:53Z")

</div>

I am indexing 300 documents in following indexes

Index A: has a `synonym_filter` with 25000 synonyms in the Index itself

Index B: the `synonym_filter` refers the synonyms from a file

I observed a drastic difference in indexing speed for both in indices.  
When synonyms were refered from a file, the indexing was way faster

**Index B**

> real 0m0.799s

> user 0m0.007s

> sys 0m0.023s

**Index A**

> real 0m10.077s

> user 0m0.008s

> sys 0m0.023s

When in "Index A" the synonyms are spread across multiple syn\_filters with ~5000 synonyms each, the indexing takes ~1 min for one document!!!

Configuration: Elasticsearch is running on localhost itself, so no network issues in play.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 14, 2017, 6:35am UTC](https://discuss.elastic.co/t/indexing-speed-elastic-search/71595/2 "2017-01-14T06:35:13Z")

</div>

Very interesting. I'm sure @jpountz and @danielmitterdorfer will be happy to reproduce and find the reason.  
If confirmed, may be we should update our documentation to advice people using that on disk.

I guess your cluster is stable so you are not updating the cluster state frequently, right?

The fact is that the synonym file is not updated so it's probably served by the file system cache. Bonus: no needs to parse the cluster state and extract synonym list for every request or keep that data structure in heap. (I didn't look at the code so just assumptions here).

---

<div class="post-metadata">

**Author:** ![vmandke](https://avatars.discourse-cdn.com/v4/letter/v/a9adbd/32.png) [@vmandke](https://discuss.elastic.co/u/vmandke)\
**Post date:** [January 14, 2017, 6:48am UTC](https://discuss.elastic.co/t/indexing-speed-elastic-search/71595/3 "2017-01-14T06:48:12Z")

</div>

yes, the cluster(which is actually a single node) is stable and I am indexing sequentially in both the Indices.

Just for info: the synonyms I am using are wordnet\_verb\_synonyms,  
and I am working on:-  
ES1.7.5

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 14, 2017, 7:10am UTC](https://discuss.elastic.co/t/indexing-speed-elastic-search/71595/4 "2017-01-14T07:10:18Z")

</div>

Ha! Can you run similar tests on 5.1?

---

<div class="post-metadata">

**Author:** ![vmandke](https://avatars.discourse-cdn.com/v4/letter/v/a9adbd/32.png) [@vmandke](https://discuss.elastic.co/u/vmandke)\
**Post date:** [January 16, 2017, 6:43am UTC](https://discuss.elastic.co/t/indexing-speed-elastic-search/71595/5 "2017-01-16T06:43:39Z")

</div>

Checked the same in ES 5

When the synonyms are referenced from the file:  
real 0m0.200s  
user 0m0.005s  
sys 0m0.006s

When the synonyms are referred from the filter:  
real 0m0.545s  
user 0m0.005s  
sys 0m0.005s

So even in ES5 the time taken to index documents is slower by ~2x, However not as slow as observed on ES1.7.5

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [January 16, 2017, 9:19am UTC](https://discuss.elastic.co/t/indexing-speed-elastic-search/71595/6 "2017-01-16T09:19:35Z")

</div>

I suspect your benchmark includes the time for index creation and hits the following issue which will be fixed in 5.2: [https://github.com/elastic/elasticsearch/pull/22249](https://github.com/elastic/elasticsearch/pull/22249).

---

<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:** [February 13, 2017, 9:19am UTC](https://discuss.elastic.co/t/indexing-speed-elastic-search/71595/7 "2017-02-13T09:19:35Z")

</div>

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