2016-09-09 12 views
1

インデックスタイプに関してElastic検索動的テンプレートを作成しようとしています(日付でインデックスを作成します) サンプルのインデックスURLは次のようになります:動的インデックスタイプに関して弾性検索テンプレートを作成する方法

http://localhost:9200/my_index/day-01-01-2016 
http://localhost:9200/my_index/day-02-01-2016 
.... 

次のようにサンプル・テンプレートは次のとおりです。

PUT my_index 
{ 
    "mappings": { 
    "day-*": {   //here, we can't use wild card for index types 
     "dynamic_templates": [ 
     { 
      "strings": { 
      "match_mapping_type": "string", 
      "mapping": { 
       "type": "string", 
       "fields": { 
       "raw": { 
        "type": "string", 
        "index": "not_analyzed", 
        "ignore_above": 256 
       } 
       } 
      } 
      } 
     } 
     ] 
    } 
    } 
} 

インデックス・タイプ用のテンプレートを作成する方法は何ですか: "日 - *"

+0

は '_default_'で*日 - 交換して、再度 – blackmamba

+0

感謝をしてみてください。それは働いてうれしい –

+0

うまく働いています。 – blackmamba

答えて

0

それが動作している次のように 私のデフォルトのインデックスは次のとおりです。

curl -XPUT localhost:9200/test_index -d ' 
{ 
    "mappings": { 
    "_default_": { 
     "dynamic_templates": [ 
     { "my_dtemplate": { 
      "match_mapping_type": "string", 
      "mapping": { 
       "type": "string", 
       "index": "not_analyzed", 
       "doc_values": true 
      } 
     }} 
     ] 
    } 
    } 
}' 
関連する問題