elasticsearch6 php,elasticsearch 6.x php-client

升级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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值