Could you advise me (or share a link) how to implement closing listeners correctly? As I've found, I should register my own AbstractLifecycleComponent and add there a LifecycleListener that will clear a cache in beforeStop() method. Is that correct?
P.S. I have the other difficulty with BulkScorer:
- If my index has nested fields, than org.elasticsearch.search.DefaultSearchContext wraps my query with BooleanQuery and add Occur.FILTER clause to it. (that become DocValuesFieldExistsQuery [field=_primary_term] in fact). Further, when executing BooleanWeight.booleanScorer() method prevents my bulkScorer been executed, because the final query has 2 required clauses (have a look there).
- I'd like to be able to wrap my query to boolean query by myself.
So, in these cases (when my query is wrapped to boolean) my bulkScorer is not called at all. Thereforе my search does not work at all. (not only caching)
Is there a way to overcome this limitation somehow?