不支持 Magento 2 EE elasticsearch Content-Type header

Magento 2 EE elasticsearch Content-Type header is not supported

我已经成功地将弹性搜索(Elasticsearch 6.0)与 Magento 企业版 2.1 集成。根据他们的文档,我尝试使用 magento cli 命令重新索引 calalog

bin/magento indexer:reindex catalogsearch_fulltext

但它会抛出类似

的错误
Catalog Search indexer process unknown error:
Content-Type header [] is not supported

我读到,Elasticsearch 6.0 实施严格 content-type checking.So 我如何在 Magento EE 2.1 中解决这个问题?

根据 Magento EE documentation,它们支持 Elasticsearch 版本 1.4、1.7 和 2.4。默认版本是 1.7.

但我尝试集成最新版本的 elasticsearch (Elasticsearch 6.0)。我已经安装了 elasticsearch 2.4,现在工作正常。

模块中的问题 - magento/module-elasticsearch。 在这个模块中 "composer.json" contain "elasticsearch/elasticsearch": "~2.0"。而且他不支持Elasticsearch 6.0。

对于版本 6,header 中应该有一个额外的参数 "Content-Type" 要发送 https://github.com/elastic/elasticsearch-php/commit/fd3b0f16f7e09cb2096ef5f2d656c9fd8dd3d61d#diff-1b0215334399d80759820e3229367adf

https://github.com/elastic/elasticsearch-php/blob/master/src/Elasticsearch/Connections/Connection.php,第 159 行,$this->headers

   $request = [
    'http_method' => $method,
    'scheme'      => $this->transportSchema,
    'uri'         => $this->getURI($uri, $params),
    'body'        => $body,
    'headers'     => array_merge([
    'Host'  => [$this->host]
    ], $this->headers)
    ];