dongyanju1094 2018-10-25 07:57
浏览 128
已采纳

Elasticsearch-php 5.x - 无法放置模板

Using the official elasticsearch-php client, version 5.x.

I'm trying to put a template inside my Elasticsearch instance, but it simply doesn't return anything.

$data = [
        'name' => 'testTemplate',
        'body' => [
            'template' => 'testTemplate-*',
            'mappings' => [
                'foo' => 'string',
                'bar' => 'string',
            ],
        ],
    ];
$this->client = ClientBuilder::create()
    ->allowBadJSONSerialization()
    ->setHosts($host)
    ->build();
$this->client->putTemplate($data);

I must use allowBadJsonSerialization() because i'm running on PHP 5.4, but on 5.6 it does the same thing.

I don't know if it's a bug or i'm doing something wrong. Can you help me? Thanks.

  • 写回答

1条回答

      报告相同问题?

      悬赏问题

      • ¥15 使用Labwindows/CVI程控万用表时自动切换量程
      • ¥15 Matlab修改xml参数后允许不了exe文件
      • ¥15 Java的问题解答一下呗
      • ¥20 怎么将vs中的程序同步到sql中的表中
      • ¥15 用flask框架接收前端上传的文本文件后怎么读取该文件
      • ¥15 有没有嵌入式ubuntu的朋友
      • ¥50 diddler Burp Suite
      • ¥20 关于UE5.1的问题,求专家解答!
      • ¥30 关于#爬虫#的问题:百度为您找到相关结果约100,000,000个 但只展现70页 有没有可能提取出来全部的搜索结果
      • ¥40 IIS部署API,弄了几天没弄出来,希望带佬远程帮我弄一下,有偿