# Get explain flag value in a custom query/scorer

**URL:** <https://discuss.elastic.co/t/get-explain-flag-value-in-a-custom-query-scorer/137589>\
**Category:** Elasticsearch\
**Created:** [June 27, 2018, 9:51am UTC](https://discuss.elastic.co/t/get-explain-flag-value-in-a-custom-query-scorer/137589 "2018-06-27T09:51:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vgindin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vgindin/32/42012_2.png) [@vgindin](https://discuss.elastic.co/u/vgindin)\
**Post date:** [June 27, 2018, 9:51am UTC](https://discuss.elastic.co/t/get-explain-flag-value-in-a-custom-query-scorer/137589/1 "2018-06-27T09:51:33Z")

</div>

I've found that _explain_ flag (that is set via URL) is transferred to org.elasticsearch.search.DefaultSearchContext. I'd like to check this flag in my custom query or custom scorer. I expected that SearchContext will be propagated to a Query, but I didn't found the way how to get it. I only have LeafReaderContext or LeafReader. Is there a way to get Search Context from the custom query or scorer?

Regards,  
Vadim Gindin

---

<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:** [July 25, 2018, 9:51am UTC](https://discuss.elastic.co/t/get-explain-flag-value-in-a-custom-query-scorer/137589/2 "2018-07-25T09:51:48Z")

</div>

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