映射定义具有不受支持的参数:[dynamic:true]

时间:2016-09-29 11:34:28

标签: elasticsearch

我一直在尝试将其中一个字段编入索引为动态,并通过添加

更改了elasticsearch.yml
index.mapper.dynamic: false

最终还重新启动了elasticsearch和kibana的感觉。还尝试了不同的字段和索引名称,但我仍然得到相同的错误:

{
"error": {
  "root_cause": [
     {
        "type": "mapper_parsing_exception",
        "reason": "Mapping definition for [albumdetailid] has unsupported parameters:  [dynamic : true]"
     }
  ],
  "type": "mapper_parsing_exception",
  "reason": "Failed to parse mapping [package]: Mapping definition for [albumdetailid] has unsupported parameters:  [dynamic : true]",
  "caused_by": {
     "type": "mapper_parsing_exception",
     "reason": "Mapping definition for [albumdetailid] has unsupported parameters:  [dynamic : true]"
  }
},
 "status": 400
}

添加索引的代码如下:

PUT /worldtest221
{ 
 "settings" : {

  "index" : {
    "creation_date" : "1474989052008",
    "uuid" : "Ae-7aFrLT466ZJL4U9QGLQ",
    "number_of_replicas" : "0",
    "analysis" : {
      "char_filter" : {
        "quotes" : {
          "type" : "mapping",
          "mappings" : [ "=>'", "=>'", "‘=>'", "’=>'", "‛=>'" ]
        }
      },
      "filter" : {
        "nGram_filter" : {
          "max_gram" : "400",
          "type" : "nGram",
          "min_gram" : "1",
          "token_chars" : [ "letter", "digit", "punctuation", "symbol" ]
        }
      },
      "analyzer" : {
        "quotes_analyzer" : {
          "char_filter" : [ "quotes" ],
          "tokenizer" : "standard"
        },
        "nGram_analyzer" : {
          "type" : "custom",
          "filter" : [ "lowercase", "asciifolding", "nGram_filter" ],
          "tokenizer" : "whitespace"
        },
        "whitespace_analyzer" : {
          "type" : "custom",
          "filter" : [ "lowercase", "asciifolding" ],
          "tokenizer" : "whitespace"
        }
      }
    },
    "cache" : {
      "query_result" : {
        "enable" : "true"
      }
    },
    "number_of_shards" : "1", 
    "version" : {
      "created" : "2030099"
    } 
   }
 },

 "mappings" : {
  "package" : {
    "properties" : {
      "autosuggestionpackagedetail" : {
        "type" : "string",
        "index" : "not_analyzed"
      },
      "availability" : {
        "type" : "nested",
        "include_in_all" : false,
        "properties" : {
          "displaysequence" : {
            "type" : "long",
            "include_in_all" : false
          },
          "isquantityavailable" : {
            "type" : "boolean"
          },
          .....
      "metatags" : {
        "type" : "string",
        "include_in_all" : false
      },
      "minadultage" : {
        "type" : "long",
        "include_in_all" : false
      },
      "newmemberrewardpoints" : {
        "type" : "long",
        "include_in_all" : false
      },
      "packagealbum" : {
        "include_in_all" : false,
        "properties" : {
          "albumdetailid" : {
            "type" : "string",
            "include_in_all" : false,
            "dynamic": true
          }, 
....

请看第二行,我提到" dynamic" :true

1 个答案:

答案 0 :(得分:1)

这是因为您尝试在字符串类型的字段(“albumdetailid”)上设置“dynamic:true”!这毫无意义!在“字符串”字段下不能创建新字段。应在“对象”字段下设置“动态”参数。所以要么将“albumdetailid”定义为“object”,要么将“dynamic:true”更高一级 - 在“packagealbum”下如下:

"packagealbum" : {
    "include_in_all" : false,
    "dynamic": true,
    "properties" : {
      "albumdetailid" : {
        "type" : "string",
        "include_in_all" : false
      }, 

...