我正在学习围绕Elasticsearch的方法。 我确实为某些文档编制了索引,但后来意识到我想为它们附加一个特定的分析器。
但是当我尝试运行“putMappings”命令时 - 它说Mapper for [short_summary] conflicts with existing mapping in other types
。如this answer中所述,我无法更改现有字段的映射。
因此,我只有一个选项 - 用分析器集重新索引文档。但是我该怎么做?
我编写的唯一代码是:
$doc = ['short_summary' = '...text...'];
$params = [
'index' => 'index_name',
'type' => 'document_type',
'id' => $doc_id,
'body' => $doc,
];
$es_client->index($params);
您是否知道在索引新文档时设置分析器的正确方法?