o19s / opensearch-ubi

OpenSearch plugin for User Behavior Insights
Apache License 2.0
6 stars 1 forks source link

Caching index settings #100

Closed jzonthemtn closed 8 months ago

jzonthemtn commented 8 months ago

For #92, cache index settings to avoid looking at the index to find the settings. This is to avoid unnecessary roundtrips when logging queries.

Upon first query, the settings are retrieved from the index. For queries after that, the setting is retrieved from the cache:

opensearch_ubi  | [2024-03-07T18:22:47,815][INFO ][o.o.u.a.UserBehaviorInsightsActionFilter] [opensearch] Getting setting index.ubi.store for store awesome from the cache.
opensearch_ubi  | [2024-03-07T18:22:47,816][INFO ][o.o.u.a.UserBehaviorInsightsActionFilter] [opensearch] Getting setting index.ubi.id_field for store awesome from the cache.

After the store is deleted and recreated, the next search will get the settings from the index since the cache has been cleared.

opensearch_ubi  | [2024-03-07T18:23:25,851][INFO ][o.o.u.a.UserBehaviorInsightsActionFilter] [opensearch] Getting setting index.ubi.store for store awesome from the index.
opensearch_ubi  | [2024-03-07T18:23:25,853][INFO ][o.o.u.a.UserBehaviorInsightsActionFilter] [opensearch] Getting setting index.ubi.id_field for store awesome from the index.
epugh commented 8 months ago

@jzonthemtn looks good except one import nit?