# Increased Search Latency post enabling writes to index

**URL:** <https://discuss.elastic.co/t/increased-search-latency-post-enabling-writes-to-index/323258>\
**Category:** Elasticsearch\
**Created:** [January 16, 2023, 2:27pm UTC](https://discuss.elastic.co/t/increased-search-latency-post-enabling-writes-to-index/323258 "2023-01-16T14:27:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeus7](https://avatars.discourse-cdn.com/v4/letter/z/a587f6/32.png) [@zeus7](https://discuss.elastic.co/u/zeus7)\
**Post date:** [January 16, 2023, 2:27pm UTC](https://discuss.elastic.co/t/increased-search-latency-post-enabling-writes-to-index/323258/1 "2023-01-16T14:27:36Z")

</div>

Hi,  
I m observing high search latency (8x-10x) post enabling writes on an index.  
I m having an index on production having continuous writes (avg write operations/sec = ~5k) and it is having search latency of 2-4sec.  
I created another index with same data on the same cluster and search latency was very low (100-200ms). What can be the reason behind this behaviour ? Please help with this.  
Es Version : 8.3.2

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 16, 2023, 2:36pm UTC](https://discuss.elastic.co/t/increased-search-latency-post-enabling-writes-to-index/323258/2 "2023-01-16T14:36:08Z")

</div>

> [@zeus7](#):
>
> I created another index with same data on the same cluster and search latency was very low (100-200ms).

Are these queries running while you are indexing into the other index you mentioned?

What is the size of the index? How many shards does it have?

What type of data does the index contain? What does the mappings look like? What is the refresh interval set to?

---

<div class="post-metadata">

**Author:** ![zeus7](https://avatars.discourse-cdn.com/v4/letter/z/a587f6/32.png) [@zeus7](https://discuss.elastic.co/u/zeus7)\
**Post date:** [January 16, 2023, 2:39pm UTC](https://discuss.elastic.co/t/increased-search-latency-post-enabling-writes-to-index/323258/3 "2023-01-16T14:39:51Z")

</div>

I performed reindexing earlier before running search queries (so not running parallelly). Index size is aroud ~1.4 tb (primary + replica). There are 10 primary shards and 2 replicas per shard. Refresh interval is default (1sec). Index contains product related data.

---

<div class="post-metadata">

**Author:** ![zeus7](https://avatars.discourse-cdn.com/v4/letter/z/a587f6/32.png) [@zeus7](https://discuss.elastic.co/u/zeus7)\
**Post date:** [January 16, 2023, 4:01pm UTC](https://discuss.elastic.co/t/increased-search-latency-post-enabling-writes-to-index/323258/4 "2023-01-16T16:01:32Z")

</div>

It was taking time because of the referesh interval being set to 1sec. Changed it to 30sec, now search latency is reduced. Thanks.

---

<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, 2023, 4:02pm UTC](https://discuss.elastic.co/t/increased-search-latency-post-enabling-writes-to-index/323258/5 "2023-02-13T16:02:14Z")

</div>

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