2016-09-29 53 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 
     }, 

....

相關問題