2017-03-27 184 views
0

我有以下遺留映射代碼在ES 1.7中工作,但在5.2中失敗。失敗的東西是multi_field不支持以及路徑。文檔提到這些字段已被刪除,但未能提供超出建議使用copy_to的補救措施。罐頭有人給了一些更詳細的信息。升級到Elasticsearch 5.2

{ 
"sample": { 
    "_parent": { 
     "type": "security" 
    }, 
    "properties": { 
     "securityDocumentId": { 
      "type": "string", 
      "index": "not_analyzed", 
      "include_in_all": false 
     }, 
     "id": { 
      "type": "multi_field", 
      "path": "full", 
      "fields": { 
       "indexer_sample_id": { 
        "type": "string" 
       }, 
       "id": { 
        "type": "string", 
        "include_in_all": false 
       } 
      } 
     }, 
     "sampleid": { 
      "type": "multi_field", 
      "path": "just_name", 
      "fields": { 
       "sampleid": { 
        "type": "string", 
        "analyzer": "my_analyzer" 
       }, 
       "sample.sampleid": { 
        "type": "string", 
        "analyzer": "my_analyzer" 
       }, 
       "sample.sampleid.sort": { 
        "type": "string", 
        "analyzer": "case_insensitive_sort_analyzer" 
       }, 
       "sample.sampleid.name.autocomplete": { 
        "type": "string", 
        "analyzer": "autocomplete" 
       } 
      } 
     }, 

回答

1

path選項的默認值是full,這樣你就可以離開它,因爲它方式2.0棄用。 pathjust_name不再存在,並且必須按全路徑名稱引用所有字段。多場可以非常簡單地改寫:

{ 
"sample": { 
    "_parent": { 
     "type": "security" 
    }, 
    "properties": { 
     "securityDocumentId": { 
      "type": "keyword", 
      "include_in_all": false 
     }, 
     "id": { 
      "type": "text", 
      "fields": { 
       "indexer_sample_id": { 
        "type": "text" 
       }, 
       "id": { 
        "type": "text", 
        "include_in_all": false 
       } 
      } 
     }, 
     "sampleid": { 
      "type": "text", 
      "fields": { 
       "sampleid": { 
        "type": "text", 
        "analyzer": "my_analyzer" 
       }, 
       "sample.sampleid": { 
        "type": "text", 
        "analyzer": "my_analyzer" 
       }, 
       "sample.sampleid.sort": { 
        "type": "text", 
        "analyzer": "case_insensitive_sort_analyzer" 
       }, 
       "sample.sampleid.name.autocomplete": { 
        "type": "text", 
        "analyzer": "autocomplete" 
       } 
      } 
     }, 

請注意,我不知道的用處和id子場

+0

任何這運氣的附加值? – Val