elasticsearch php Content-Type header [] is not supported
作者:会飞的
Content-Typeheader[]isnotsupportedif(is_null($this->connectionFactory)){if(is_null($this->connectionParams)){$this->connectionParams=[];}//MakesurewearesettingContent-TypeandAccept(unlesstheuserhasexplicitly//overriddenit//解决办法,需要在
Content-Type header [] is not supported
if (is_null($this->connectionFactory)) {
if (is_null($this->connectionParams)) {
$this->connectionParams = [];
}
// Make sure we are setting Content-Type and Accept (unless the user has explicitly
// overridden it
//解决办法,需要在header增加json
if (isset($this->connectionParams['client']['headers']) === false) {
$this->connectionParams['client']['headers'] = [
'Content-Type' => ['application/json'],
'Accept' => ['application/json']
];
} else {
if (isset($this->connectionParams['client']['headers']['Content-Type']) === false) {
$this->connectionParams['client']['headers']['Content-Type'] = ['application/json'];
}
if (isset($this->connectionParams['client']['headers']['Accept']) === false) {
$this->connectionParams['client']['headers']['Accept'] = ['application/json'];
}
}
$this->connectionFactory = new ConnectionFactory($this->handler, $this->connectionParams, $this->serializer, $this->logger, $this->tracer);
}
linux命令
curl -H "Content-Type: application/json" http://localhost:9200/index/_search?pretty -d ' {"query": {"match_all": {}}}'
有用 | 无用猜你喜欢
您可能感兴趣的文章:
- php中print_r、var_dump和var_export
- PHP中strtr和str_replace比较
- PHP中超时提示Fatal error Maximum execution time of 30 seconds exceeded的解决方案
- PHP中的stristr(),strstr(),strpos()速度比较
- rawurlencode()和urlencode()函数区别
- Smarty优缺点
- Warning Cannot modify header information - headers already sent by
- 编写安全 PHP 应用程序的七个习惯
- 二维数组的array_unique函数
- 截取中文字符串时屏蔽乱码
- 静态页面已不利于搜索引擎优化和收录和排名
- 企业网站优化的弊端如何改变
- 去掉桌面图标阴影
- 如何针对MSN搜索进行网站优化
- 使用 mb_detect_encoding() 函数来判断字符串是什么编码的
- 网页状态码的含义网页错误类型详情
- 用php处理百万级以上的数据提高查询速度的方法
- 用php防止XSS跨站脚本攻击的方法
- 用php过滤网页中所有的html,css,js代码