# LDAP realm caching

**URL:** <https://discuss.elastic.co/t/ldap-realm-caching/174989>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [April 2, 2019, 12:38pm UTC](https://discuss.elastic.co/t/ldap-realm-caching/174989 "2019-04-02T12:38:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamesNotJamez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jamesnotjamez/32/45736_2.png) [@JamesNotJamez](https://discuss.elastic.co/u/JamesNotJamez)\
**Post date:** [April 2, 2019, 12:38pm UTC](https://discuss.elastic.co/t/ldap-realm-caching/174989/1 "2019-04-02T12:38:07Z")

</div>

Is the ldap realm setting cache.ttl for Authorization, Authentication or both?  
We are currently seeing Elasticsearch doing 15000 searches an hour to our Ldap server.

We have not explicitly set the field value ourselves, but documentation says there is a 20m default.

Also worth noting we are running in ECE if that has an affect on any config settings.

Many thanks

---

<div class="post-metadata">

**Author:** ![Yogesh\_Gaikwad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yogesh_gaikwad/32/27025_2.png) [@Yogesh\_Gaikwad](https://discuss.elastic.co/u/Yogesh_Gaikwad)\
**Post date:** [April 3, 2019, 12:47am UTC](https://discuss.elastic.co/t/ldap-realm-caching/174989/2 "2019-04-03T00:47:37Z")

</div>

Hi @JamesNotJamez,

The setting `cache.ttl` is used to cache user entries where the resolved roles and credentials are cached for `20 minutes` by default. So yes it is used for Authentication and Authorization.  
_ **Note: that reads through cache do not prevent cache entry expiry** _

Could you please provide some more details?

- What version of Elasticsearch are you using?
- enable the debug logs on ES for `org.elasticsearch.xpack.security.authc.ldap` and share the logs?
- no of unique logins to the ES server within that hour, you can look through audit logs.

Hope this helps.

Thanks and Regards,  
Yogesh Gaikwad

---

<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:** [May 1, 2019, 12:47am UTC](https://discuss.elastic.co/t/ldap-realm-caching/174989/3 "2019-05-01T00:47:41Z")

</div>

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