2016-11-21 11 views
1

にnon_analyzedへのマッピングを変更することはできません:は、私は次のようなマッピングとDOCTYPEを持ってElasticSearch

GET my_index/my_doctype/_mapping 
{ 
    "my_index": { 
    "mappings": { 
     "my_doctype": { 
     "properties": { 
      "@timestamp": { 
      "type": "date", 
      "format": "strict_date_optional_time||epoch_millis" 
      }, 
      "@version": { 
      "type": "string" 
      }, 
      "prod_id": { 
      "type": "string" 
      }, 
      "host": { 
      "type": "string" 
      }, 
      "message": { 
      "type": "string" 
      }, 
      "path": { 
      "type": "string" 
      }, 
      "img_path": { 
      "type": "string" 
      }, 
      "tags": { 
      "type": "string" 
      } 
     } 
     } 
    } 
    } 
} 

私は、私はこの要求を実行するnon_analyzedanalyzedからいくつかのフィールドを変更しようとしています:

PUT my_index/_mapping/my_doctype 
{ 
    "properties": { 
    "prod_id": { 
     "type": "string", 
     "index": "not_analyzed" 
    }, 
    "img_path": { 
     "type": "string", 
     "index": "not_analyzed" 
    } 
    } 
} 

しかし、私は次のエラーを取得しています:

{ 
    "error": { 
     "root_cause": [ 
     { 
      "type": "illegal_argument_exception", 
      "reason": "Mapper for [img_path] conflicts with existing mapping in other types:\n[mapper [img_path] has different [index] values, mapper [img_path] has different [doc_values] values, cannot change from disabled to enabled, mapper [img_path] has different [analyzer], mapper [img_path] is used by multiple types. Set update_all_types to true to update [omit_norms] across all types., mapper [img_path] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [img_path] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]" 
     } 
     ], 
     "type": "illegal_argument_exception", 
     "reason": "Mapper for [img_path] conflicts with existing mapping in other types:\n[mapper [img_path] has different [index] values, mapper [img_path] has different [doc_values] values, cannot change from disabled to enabled, mapper [img_path] has different [analyzer], mapper [img_path] is used by multiple types. Set update_all_types to true to update [omit_norms] across all types., mapper [img_path] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [img_path] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]" 
    }, 
    "status": 400 
} 

ホーフィールド "prod_id"と "img_path"をnot_analyzedに変更する

答えて

1

既存のフィールドのマッピングを変更することはできません。 は、あなたのデータを

  1. あなたのインデックスを削除することができ、適切なマッピングおよび再インデックスでそれを再作成してデータ
  2. あなたはnot_analyzedサブフィールドを作成することができ、再インデックス:次の2つのソリューションを持っています

    第二の溶液は、このように書き:

    PUT my_index/_mapping/my_doctype 
    { 
        "properties": { 
        "prod_id": { 
         "type": "string", 
         "fields": { 
         "raw": { 
          "type": "string", 
          "index": "not_analyzed" 
         } 
         } 
        }, 
        "img_path": { 
         "type": "string", 
         "fields": { 
         "raw": { 
          "type": "string", 
          "index": "not_analyzed" 
         } 
         } 
        } 
        } 
    } 
    

    そして、あなたがreindexeを持った後、あなたはprod_id.rawimg_path.rawを使用することができますあなたのデータ。

+0

回答をお寄せいただきありがとうございます。どのようにインデックスを再作成するのですか?私は最初にlogstashを使ってインデックスを作成しています。 – MedAli

+0

同じように、Logstashの設定を再実行するだけで、新しい/更新されたインデックスが設定されます – Val

+0

ありがとうございます!しましょう – MedAli

関連する問題