# Read elastic rate limit headers from response

**URL:** <https://discuss.elastic.co/t/read-elastic-rate-limit-headers-from-response/369411>\
**Category:** Elasticsearch\
**Created:** [October 25, 2024, 9:42am UTC](https://discuss.elastic.co/t/read-elastic-rate-limit-headers-from-response/369411 "2024-10-25T09:42:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CTO\_Servefast](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cto_servefast/32/131802_2.png) [@CTO\_Servefast](https://discuss.elastic.co/u/CTO_Servefast)\
**Post date:** [October 25, 2024, 9:42am UTC](https://discuss.elastic.co/t/read-elastic-rate-limit-headers-from-response/369411/1 "2024-10-25T09:42:46Z")

</div>

Hi,,

we are using provided code

```auto
const response = await client.app.indexDocuments({
      engine_name: engineName,
      documents: snakeCaseDocuments,
    });

```

We are hitting API requests limits and we would like to implement debouncing for our request but we can not get the limits.

We have added 200ms debounce but it slows down our requests a lot we would like to track the limits and react based on that.

Thank you

Best regards

---

<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:** [October 25, 2024, 5:23pm UTC](https://discuss.elastic.co/t/read-elastic-rate-limit-headers-from-response/369411/2 "2024-10-25T17:23:13Z")

</div>

What is the specification of your cluster?

If you are looking to optimise indexing throughput I would recommend you [follow these guidelines](https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-indexing-speed.html) and use bulk requests as indexing individual documents adds a lot of overhead.

---

<div class="post-metadata">

**Author:** ![CTO\_Servefast](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cto_servefast/32/131802_2.png) [@CTO\_Servefast](https://discuss.elastic.co/u/CTO_Servefast)\
**Post date:** [October 28, 2024, 8:44am UTC](https://discuss.elastic.co/t/read-elastic-rate-limit-headers-from-response/369411/3 "2024-10-28T08:44:46Z")

</div>

Is there a reason why index documents in the background doesnt use bulk insert? Doest it do one request per document then i didnt see the implementation of the function?

And this is our setup but we are looking into serverless since we would like a better managed scaling. At least we think that will help us since we have thousands of users that will be using elastic to sync and search their data.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/1/41877011de5dd3a2d81e39279c46554ca531645d.png)

---

<div class="post-metadata">

**Author:** ![CTO\_Servefast](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cto_servefast/32/131802_2.png) [@CTO\_Servefast](https://discuss.elastic.co/u/CTO_Servefast)\
**Post date:** [October 28, 2024, 8:48am UTC](https://discuss.elastic.co/t/read-elastic-rate-limit-headers-from-response/369411/4 "2024-10-28T08:48:34Z")

</div>

We are also not sure which type of hardware profile should be best for us since we have a high load on indexing

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/7/f7801ffc7346fad5c65680ccc37075fb366bd61f.png)

---

<div class="post-metadata">

**Author:** ![CTO\_Servefast](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cto_servefast/32/131802_2.png) [@CTO\_Servefast](https://discuss.elastic.co/u/CTO_Servefast)\
**Post date:** [November 4, 2024, 12:43pm UTC](https://discuss.elastic.co/t/read-elastic-rate-limit-headers-from-response/369411/5 "2024-11-04T12:43:17Z")

</div>

Hi Cristian,

also index documents shouldnt index documents by individiual documents.

```auto
    indexDocuments(this: That, params: T.IndexDocumentsRequest, options?: TransportRequestOptions): Promise<T.IndexDocumentsResponse>;

```

This is the functions signature. It should index n documents and the limit is 100 if i am not mistaken
