# Elasticserch slowly inserts a row

**URL:** <https://discuss.elastic.co/t/elasticserch-slowly-inserts-a-row/51298>\
**Category:** Elasticsearch\
**Created:** [May 30, 2016, 9:28am UTC](https://discuss.elastic.co/t/elasticserch-slowly-inserts-a-row/51298 "2016-05-30T09:28:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![111122](https://avatars.discourse-cdn.com/v4/letter/1/ce7236/32.png) [@111122](https://discuss.elastic.co/u/111122)\
**Post date:** [May 30, 2016, 9:28am UTC](https://discuss.elastic.co/t/elasticserch-slowly-inserts-a-row/51298/1 "2016-05-30T09:28:04Z")

</div>

We have got a problem with elasticsearch. When we used version 1.7.0 of elasticsearch the speed of insertion a row was approximately 0.01 sec but when we updated version on 2.3.1 the speed of insertion a row slowed down approximately in 10 times, i.e. it became about 0.1 second. Our OS: Ubuntu 14.04 LTS

java version "1.7.0\_101" OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1) OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

also we have tried with:

java version "1.8.0\_91" Java(TM) SE Runtime Environment (build 1.8.0\_91-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

but we have got same results with speed.

mapping: {"properties":{"id\_item":{"type":"long"},"id\_position\_to\_item":{"type":"integer"},"cost":{"type":"long"},"cost\_per":{"type":"long"},"id\_country\_to\_item":{"type":"integer"},"id\_oblast\_to\_item":{"type":"integer"},"id\_raion\_to\_item":{"type":"integer"},"id\_city\_to\_item":{"type":"integer"},"id\_metro":{"type":"integer"},"id\_borough":{"type":"integer"},"id\_borough\_sup":{"type":"integer"},"id\_way":{"type":"integer"},"street\_id":{"type":"integer"},"time\_create":{"type":"long"},"time\_add":{"type":"long"},"time\_delete":{"type":"long"},"square\_item":{"type":"float"},"count\_room":{"type":"integer"},"mark\_add\_day":{"type":"long"},"mark\_del\_day":{"type":"long"},"mark\_pub\_day":{"type":"long"}}}

row insert: {"id\_position\_to\_item":"499","id\_item":"3","cost":"3105000","cost\_per":"3105000","id\_country\_to\_item":"1","id\_oblast\_to\_item":"26","id\_raion\_to\_item":"0","id\_city\_to\_item":"499","id\_metro":"0","id\_borough":"0","id\_borough\_sup":"0","id\_way":"17","street\_id":"220920","square\_item":"35.1","count\_room":"2","id\_for\_es":"3","mark\_add\_day":1459371600,"mark\_del\_day":1459630800,"mark\_pub\_day":[1459371600,1459458000,1459544400,1459630800]}

---

<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:** [May 30, 2016, 9:50am UTC](https://discuss.elastic.co/t/elasticserch-slowly-inserts-a-row/51298/2 "2016-05-30T09:50:34Z")

</div>

It's not a row, it's a document.

However it is probably due to the fact that we fsync the translog on every write operation in 2.X.  
Are you using bulk?

---

<div class="post-metadata">

**Author:** ![111122](https://avatars.discourse-cdn.com/v4/letter/1/ce7236/32.png) [@111122](https://discuss.elastic.co/u/111122)\
**Post date:** [May 30, 2016, 11:12am UTC](https://discuss.elastic.co/t/elasticserch-slowly-inserts-a-row/51298/3 "2016-05-30T11:12:25Z")

</div>

No, I don't use bulk.  
Does the problem connect with "fsync and commit after every request"? Because commit had been every 5 seconds in version 1.7.  
So according to you advice should I set index.translog.durability = async?

---

<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:** [May 30, 2016, 1:00pm UTC](https://discuss.elastic.co/t/elasticserch-slowly-inserts-a-row/51298/4 "2016-05-30T13:00:57Z")

</div>

Setting `durability = async` puts you in a situation that you could lose data, so a better option would be to group indexing requests together in larger bulk requests. For instance if you can put 1000 indexing requests in a single bulk, elasticsearch will perform ${num\_shards} fsync calls instead of 1000.

---

<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, 10:48pm UTC](https://discuss.elastic.co/t/elasticserch-slowly-inserts-a-row/51298/5 "2017-07-05T22:48:02Z")

</div>


