elasticsearchのインデックス作成時にデフォルトのマッピングダイナミックテンプレートを提供していて、それが期待どおりに機能するかどうかをチェックしたかったのです。私は困惑しました、どうすればそれを確認できますか? (ES 2.2.2を使用した作業) Elasticsearch、動的マッピングが機能するかどうかを確認する方法は?
"mappings": {
"_default_": {
"dynamic_templates": [
{
"no_date_detection": {
"match_mapping_type": "string",
"mapping": {
"type": "string",
"date_detection": false
}
}
},
{
"language_de": {
"match_mapping_type": "*",
"match": "*_de",
"mapping": {
"type": "string",
"analyzer": "german"
}
}
},
{
"language_es": {
"match": "*_es",
"match_mapping_type": "*",
"mapping": {
"type": "string",
"analyzer": "spanish"
}
}
},
{
"language_en": {
"match": "*_en",
"match_mapping_type": "*",
"mapping": {
"type": "string",
"analyzer": "english"
}
}
}
]
}
}
それはマニュアルに記載されている例のように、非常に簡単です。
マッピングは、動的テンプレートが新しいタイプに
"testobject": {
"dynamic_templates": [
{
"no_date_detection": {
"mapping": {
"type": "string",
"date_detection": false
},
"match_mapping_type": "string"
}
},
{
"language_de": {
...
を伝承していることを示して取得しかし、私は 「description_en」のような新しいフィールドを持つオブジェクトを作成するとき:「いくつかの英語のテキスト」 をしてマッピングをGETその中に「英語」 :それはちょうど、これが 「アナライザー」を持つべきではない
"description_en": {
"type": "string"
}
を示して?
私は何が間違っていましたか、ダイナミックマッピングが正しい場合、どのように適用されることを確認できますか?事前に
感謝/カーステン私の質問として
「どのように私はそれが適用されることを確認することができますか?」不明のようだ、私は簡単にするために試してみてください。
- 私はデフォルト動的マッピングを使用して索引を作成します。
- "testobject"タイプを作成します。
- "GET/myindex/testobject/_mappings"は、期待どおりに動的テンプレートが型に渡されることを検証します。
- 私はtestobject型のオブジェクトに新しいフィールドを作成します。
- "GET/myindex/testobject/_mappings"には新しいフィールドが表示されますが、ではなく、と言うと 'date_detection':false 'と表示されます。単純な文字列として表示します(上記参照)。
ダイナミックテンプレートが新しく作成されたフィールドに適用されたかどうかを確認するにはどうすればよいですか?
簡体例:
PUT /myindex
{
"mappings": {
"_default_": {
"dynamic_templates": [
{
"no_date_detection": {
"match_mapping_type": "string",
"mapping": {
"type": "string",
"date_detection": false
}
}
}
]
}
}
}
PUT /myindex/gardeners/1
{
"name": "gary"
}
GET /myindex/_mapping
{
"myindex": {
"mappings": {
"gardeners": {
"dynamic_templates": [
{
"no_date_detection": {
"mapping": {
"type": "string",
"date_detection": false
},
"match_mapping_type": "string"
}
}
],
"properties": {
"name": {
"type": "string"
}
}
},
"_default_": {
"dynamic_templates": [
{
"no_date_detection": {
"mapping": {
"type": "string",
"date_detection": false
},
"match_mapping_type": "string"
}
}
]
}
}
}
}
私の新しいフィールド "名前"
"properties": {
"name": {
"type": "string"
}
}
doen'tのマッピングは、それが受け継がれないのはなぜ "date_detection": false
が含まれていますか?
ためのヤニックへ
感謝。どのルールが適用されているかを確認/確認するにはどうすればよいですか? –
「どちらのルールも表示されません」とはどういう意味ですか?フィールドのマッピングは、ルールが適用されたかどうかの証明です。また、インデックス/タイプ(存在しない場合はあなたのタイプに対して自動的に作成されるマッピング)のマッピングでは、 'dynamic_templates'セクションで定義された動的テンプレートが表示されます。 –
私はあなたのことを聞いていますが、私の質問がどうやってあいまいなのか分かりません。 (私は私の質問を上げようとしています(上記参照)。 –