# How to implement ETags?

**URL:** <https://discuss.elastic.co/t/how-to-implement-etags/191102>\
**Category:** Elasticsearch\
**Created:** [July 17, 2019, 10:31pm UTC](https://discuss.elastic.co/t/how-to-implement-etags/191102 "2019-07-17T22:31:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpm1984](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rpm1984/32/36595_2.png) [@rpm1984](https://discuss.elastic.co/u/rpm1984)\
**Post date:** [July 17, 2019, 10:31pm UTC](https://discuss.elastic.co/t/how-to-implement-etags/191102/1 "2019-07-17T22:31:09Z")

</div>

Hi there!

I have a setup like following:

Clients (browser, mobile apps, etc) =\> API proxy =\> Elasticsearch

I'd like to implement ETags, so that i can save bandwidth to the clients.

In the past (e.g when hiting a RDMS), i've done this on the API proxy by doing a simple hash of the response, and using that as the value.

But was wondering if there's something in the Elasticsearch response (i'm mostly using the Search API) that i can use for the ETag, to both save on the CPU cycles to create my own, and also to potentially issue conditional requests to ES from my API proxy? (although i'm mainly wanting it for the clients)

Thanks!

---

<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:** [July 17, 2019, 11:24pm UTC](https://discuss.elastic.co/t/how-to-implement-etags/191102/2 "2019-07-17T23:24:47Z")

</div>

> [@rpm1984](#):
>
> ETags

Can you elaborate a little more on what you mean by this\>

---

<div class="post-metadata">

**Author:** ![rpm1984](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rpm1984/32/36595_2.png) [@rpm1984](https://discuss.elastic.co/u/rpm1984)\
**Post date:** [July 18, 2019, 12:56am UTC](https://discuss.elastic.co/t/how-to-implement-etags/191102/3 "2019-07-18T00:56:19Z")

</div>

> **[HTTP ETag](https://en.m.wikipedia.org/wiki/HTTP_ETag)**
>
> The ETag or entity tag is part of HTTP, the protocol for the World Wide Web. It is one of several mechanisms that HTTP provides for Web cache validation, which allows a client to make conditional requests. This allows caches to be more efficient and saves bandwidth, as a Web server does not need to send a full response if the content has not changed. ETags can also be used for optimistic concurrency control, as a way to help prevent simultaneous updates of a resource from overwriting each othe

I'm hoping ES has a value I can use for the etag that I send onto clients in the API responses.

Otherwise I would have to hash the ES response and do it myself

---

<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:** [August 15, 2019, 12:56am UTC](https://discuss.elastic.co/t/how-to-implement-etags/191102/4 "2019-08-15T00:56:21Z")

</div>

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