elasticsearch映射动态模板

时间:2015-02-02 12:40:26

标签: elasticsearch

我的地图有什么问题?我收到了:

{"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',
            ],
       ...
    ];
}

1 个答案:

答案 0 :(得分:1)

映射应如下所示:

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

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