2016-09-29 60 views
0

我一直试图让中的一个字段建立索引是动态的,并且也改变了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 
      }, 
.... 

看倒数第二行,其中我提到“动态“:true

回答

1

发生这种情况是因为您试图在字符串类型的字段(”albumdetailid“)上设置”dynamic:true“!这没有道理!在“字符串”字段下不能创建新字段。 “动态”参数应该设置在“对象”字段下。所以无论是界定“albumdetailid”作为“对象”,或把“动态:真正的”高一个级别 - 在“packagealbum”是这样的:

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

....

相关问题