You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But for the first case, we set an empty array as the default value (as the options are omitted from the call). Now, PHP doesn't know whether an empty array should be serialized to an object or an array, and (somewhat unfortunately) defaults to a JSON array, which triggers the following error:
Elasticsearch\Common\Exceptions\BadRequest400Exception
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"No alias is specified"}],"type":"illegal_argument_exception","reason":"No alias is specified"},"status":400}
at vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:675
671▕ $exception = new ScriptLangNotSupportedException($responseBody. $statusCode);
672▕ } elseif ($statusCode === 408) {
673▕ $exception = new RequestTimeout408Exception($responseBody, $statusCode);
674▕ } else {
➜ 675▕ $exception = new BadRequest400Exception($responseBody, $statusCode);
676▕ }
677▕
678▕ $this->logRequestFail($request, $response, $exception);
679▕
This can be alleviated by defaulting to an instance of \ArrayObject, instead.
The text was updated successfully, but these errors were encountered:
This happens due to the way PHP serializes empty arrays. Elasticsearch expects a request like the following (taken from the docs):
The library allows expressing the above fluently:
But for the first case, we set an empty array as the default value (as the options are omitted from the call). Now, PHP doesn't know whether an empty array should be serialized to an object or an array, and (somewhat unfortunately) defaults to a JSON array, which triggers the following error:
This can be alleviated by defaulting to an instance of
\ArrayObject
, instead.The text was updated successfully, but these errors were encountered: