我的映射有什么问题?我收到:

{"error":"ClassCastException[java.util.LinkedHashMap cannot be cast to java.util.List]","status":500}

我在ubuntu服务器上使用ElasticSearch 1.1.1。
如果我删除动态模板,则可以使用
$this->mapping = [
        "dynamic_templates" => [
            'all_fields' => [
                'match' => "*",
                'match_mapping_type' => 'string',
                'mapping' => [
                    'index' => 'not_analyzed',
                ],
            ],
        ],
        'properties' => [
            'state' => [
                'type' => 'boolean',
            ],
       ...
    ];
}

最佳答案

映射应如下所示:

"dynamic_templates" => [
    ['all_fields' => [
        'match' => "*",
        'match_mapping_type' => 'string',
        'mapping' => [
            'index' => 'not_analyzed',
            ],
    ]],
],

请注意,字段定义应该是标量数组内的关联数组。

关于elasticsearch - elasticsearch映射动态模板,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28277988/

10-10 15:52