使用官方的elasticsearch-php客户端5.x版。
我试图在我的Elasticsearch实例中放置一个模板,但是它根本不返回任何东西。
$data = [
'name' => 'testTemplate',
'body' => [
'template' => 'testTemplate-*',
'mappings' => [
'foo' => 'string',
'bar' => 'string',
],
],
];
$this->client = ClientBuilder::create()
->allowBadJSONSerialization()
->setHosts($host)
->build();
$this->client->putTemplate($data);我必须使用allowBadJsonSerialization(),因为我是在PHP5.4上运行的,但是在5.6上它做了同样的事情。
我不知道是虫子还是我做错了什么。你能帮帮我吗?谢谢。
发布于 2019-04-02 13:13:38
根据文档的说法,我用卷发解决了这个问题。
不幸的是,这个库不适用于5.x分支。
https://stackoverflow.com/questions/52984172
复制相似问题