# How to use "explain" in Elasticsearch-PHP search operation?

**URL:** <https://discuss.elastic.co/t/how-to-use-explain-in-elasticsearch-php-search-operation/270367>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [April 16, 2021, 9:40am UTC](https://discuss.elastic.co/t/how-to-use-explain-in-elasticsearch-php-search-operation/270367 "2021-04-16T09:40:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DimanG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dimang/32/81770_2.png) [@DimanG](https://discuss.elastic.co/u/DimanG)\
**Post date:** [April 16, 2021, 9:40am UTC](https://discuss.elastic.co/t/how-to-use-explain-in-elasticsearch-php-search-operation/270367/1 "2021-04-16T09:40:43Z")

</div>

Hi!

I'm using ELK via Elasticsearch-PHP. I want to use "explain" in certain circumstances. When I write "explain" or "\_explain" before or within "body" the result contains explanation in some cases, but it always returns with exceptions like this:

Elasticsearch\Common\Exceptions\UnexpectedValueException - explain is not a valid parameter. Allowed parameters are allow\_no\_indices, analyze\_wildcard, analyzer, default\_operator, df, error\_trace, expand\_wildcards, filter\_path, human, ignore\_throttled, ignore\_unavailable, lenient, min\_score, opaqueId, preference, pretty, q, routing, source, terminate\_after

Elasticsearch\Common\Exceptions\UnexpectedValueException - \_explain is not a valid parameter. Allowed parameters are \_source, \_source\_excludes, \_source\_includes, allow\_no\_indices, allow\_partial\_search\_results, analyze\_wildcard, analyzer, batched\_reduce\_size, ccs\_minimize\_roundtrips, default\_operator, df, docvalue\_fields, error\_trace, expand\_wildcards, explain, filter\_path, from, human, ignore\_throttled, ignore\_unavailable, lenient, max\_concurrent\_shard\_requests, opaqueId, pre\_filter\_shard\_size, preference, pretty, q, request\_cache, rest\_total\_hits\_as\_int, routing, scroll, search\_type, seq\_no\_primary\_term, size, sort, source, stats, stored\_fields, suggest\_field, suggest\_mode, suggest\_size, suggest\_text, terminate\_after, timeout, track\_scores, track\_total\_hits, typed\_keys, version

Elasticsearch\Common\Exceptions\BadRequest400Exception - {"error":{"root\_cause":[{"type":"parsing\_exception","reason":"request does not support [explain]","line":1,"col":2}],"type":"parsing\_exception","reason":"request does not support [explain]","line":1,"col":2},"status":400}

Elasticsearch\Common\Exceptions\BadRequest400Exception - {"error":{"root\_cause":[{"type":"parsing\_exception","reason":"Unknown key for a VALUE\_BOOLEAN in [\_explain].","line":1,"col":32}],"type":"parsing\_exception","reason":"Unknown key for a VALUE\_BOOLEAN in [\_explain].","line":1,"col":32},"status":400}

Is it possible and how to get what I want?

Thanks in advance.

---

<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 14, 2021, 9:41am UTC](https://discuss.elastic.co/t/how-to-use-explain-in-elasticsearch-php-search-operation/270367/2 "2021-05-14T09:41:02Z")

</div>

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