升级6.x版本后,使用官方的php客户端访问会报出如下错误。
经查询后,知道需要添加请求头Content-Type,使用curl的方式可以很方便的添加,但是在php-client中这个请求头该如何去添加呢
找了很多资料没有头绪,大家有谁知道吗,谢谢。
Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":"Content-Type header [] is not supported","status":406}' in /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:669
Stack trace:
#0 /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(640): Elasticsearch\Connections\Connection->tryDeserializeError(Array, 'Elasticsearch\C...')
#1 /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(561): Elasticsearch\Connections\Connection->tryDeserialize400Error(Array)
#2 /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(262): Elasticsearch\Connections\Connection->process4xxError(Array, Array, Array)
#3 /data/elf/vendor/react/promise/src/FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections\{closure}(Array)
#4 /data/elf/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php(55): React\ in /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 671
经查询后,知道需要添加请求头Content-Type,使用curl的方式可以很方便的添加,但是在php-client中这个请求头该如何去添加呢
找了很多资料没有头绪,大家有谁知道吗,谢谢。
Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":"Content-Type header [] is not supported","status":406}' in /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:669
Stack trace:
#0 /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(640): Elasticsearch\Connections\Connection->tryDeserializeError(Array, 'Elasticsearch\C...')
#1 /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(561): Elasticsearch\Connections\Connection->tryDeserialize400Error(Array)
#2 /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(262): Elasticsearch\Connections\Connection->process4xxError(Array, Array, Array)
#3 /data/elf/vendor/react/promise/src/FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections\{closure}(Array)
#4 /data/elf/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php(55): React\ in /data/elf/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 671
1 个回复
medcl - 今晚打老虎。
赞同来自: