【问题标题】:Root mapping definition has unsupported parameters: [_timestamp : {enabled=true}]根映射定义具有不受支持的参数:[_timestamp : {enabled=true}]
【发布时间】:2020-02-13 23:45:45
【问题描述】:

我正在尝试为 ES 6.6.0 设置以下映射,但出现此错误; Caused by: org.elasticsearch.index.mapper.MapperParsingException: Root mapping definition has unsupported parameters: [_timestamp : {enabled=true}]

我认为这最初来自 ES2,但我不能确定。不正确的类型存在一些问题,因此我已将属性 ActionNameUserNamestring 更改为 keyword

{
    "template": "audit_*",
    "aliases": {
        "{index}_read": {},
        "{index}_write": {},
        "{index}_verify": {}
    },
    "settings": {
        "index": {
                "number_of_shards": 12,
                "number_of_replicas": 2
        },
        "analysis": {
                "analyzer": {
                    "str_search_analyzer": {
                        "tokenizer": "keyword",
                        "filter": [
                            "lowercase",
                            "substring"
                            ]
                    },
                    "str_index_analyzer": {
                        "tokenizer": "keyword",
                        "filter": [
                            "lowercase",
                            "substring"
                            ]
                    },
                    "lwhitespace": {
                        "tokenizer": "whitespace",
                        "filter": [
                            "lowercase"
                            ]
                    }
                },
                "filter": {
                    "substring": {
                        "type": "nGram",
                        "min_gram": 1,
                        "max_gram": 20
                    }
                }
        }
    },
    "mappings": {
        "audit": {
                "dynamic_templates": [
                    {
                    "raw": {
                        "match_pattern": "regex",
                        "path_match": "Details\\.auditElement\\..*",
                        "mapping": {
                            "type": "string",
                            "fields": {
                            "Raw": {
                                "analyzer": "lwhitespace",
                                "type": "string"
                            }
                            }
                        },
                        "match_mapping_type": "string"
                    }
                    },
                    {
                    "newvalue": {
                        "match_pattern": "regex",
                        "path_match": ".*\\.newValue$",
                        "mapping": {
                            "type": "string",
                            "fields": {
                            "Raw": {
                                "analyzer": "lwhitespace",
                                "type": "string"
                            }
                            }
                        }
                    }
                    },
                    {
                    "oldvalue": {
                        "match_pattern": "regex",
                        "path_match": ".*\\.oldValue$",
                        "mapping": {
                            "type": "string",
                            "fields": {
                            "Raw": {
                                "analyzer": "lwhitespace",
                                "type": "string"
                            }
                            }
                        }
                    }
                    },
                    {
                    "analytics_text": {
                        "match_pattern": "regex",
                        "path_match": ".*\\.#text$",
                        "mapping": {
                            "type": "string",
                            "fields": {
                            "Raw": {
                                "analyzer": "lwhitespace",
                                "type": "string"
                            }
                            }
                        }
                    }
                    }
                ],
                "_timestamp": {
                    "enabled": true
                },
                "_size": {
                    "enabled": true
                },
                "properties": {
                    "ActionName": {
                        "type": "keyword",
                        "index": true
                    },
                    "TimeStamp": {
                       "type": "date",
                       "format": "strict_date_optional_time||epoch_millis"
                    },
                    "UserName": {
                        "type": "keyword",
                        "index": true
                    }
                }
        }
    }
}

【问题讨论】:

    标签: elasticsearch mapping


    【解决方案1】:

    你的直觉是正确的,_timestamp 元字段was deprecated in 2.0

    _timestamp 字段已弃用。相反,请使用普通的 date 字段并明确设置其值

    此外,_size 元字段可能无法正常工作,因为它需要安装映射器大小插件。

    如果您不需要这些字段,则应将它们从映射中删除。

    我想您还必须更新动态映射中的类型(将string 替换为keywordtext)。

    希望有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多