22

私はESドキュメントに混乱しています。実際、ここでは、インデックスはマッピングディレクトリ(およびインデックス名サブディレクトリ)に配置する必要があると述べています。

マッピングは [mapping_name].json というファイル内で定義でき、config/mappings/_default の場所、または config/mappings/[index_name] (特定のインデックスのみに関連付ける必要があるマッピングの場合) の下に配置できます。

しかし、ここの「構成」セクションでは、次のように述べています。

インデックス テンプレートは、テンプレート ディレクトリの下の構成場所 (path.conf) 内に配置することもできます (すべてのマスター適格ノードに配置するようにしてください)。たとえば、template_1.json というファイルを config/templates の下に配置すると、インデックスに一致する場合に追加されます。

マッピングを入れる/config/mappings/myindexname/mappinfile.jsonと、次のようになります。

{
    "template": "maincontentindex",
    "settings": {
        "index": {
            "analysis": {
                "analyzer": {
                    "htmlStrippingAnalyzer": {
                        "tokenizer": "standard",
                        "filter": ["standard", "lowercase"],
                        "char_filter": "html_strip"
                    }
                }
            }
        }
    },

    "mappings": {
        "rendition": {
            "_timestamp": {
                "enabled": true,
                "store" : true
            },
            "properties": {
                "key": {
                    "type": "string",
                    "store": "yes",
                    "analyzer": "keyword"
                },
                "parentPage": {
                    "type": "string",
                    "store": "yes",
                    "analyzer": "keyword"
                },
                "type": {
                    "type": "string",
                    "store": "yes",
                    "analyzer": "keyword"
                },
                "language": {
                    "type": "string",
                    "store": "yes",
                    "analyzer": "keyword"
                },
                "device": {
                    "type": "string",
                    "store": "yes",
                    "analyzer": "keyword"
                },
                "territory": {
                    "type": "string",
                    "store": "yes",
                    "analyzer": "keyword"
                },
                "channel": {
                    "type": "string",
                    "store": "yes",
                    "analyzer": "keyword"
                },
                "template": {
                    "type": "string",
                    "store": "yes",
                    "analyzer": "keyword"
                },
                "meta": {
                    "properties": {
                        "content": {
                            "type": "string",
                            "store": "yes"
                        }
                    }
                }       
            }
        }
    }
}

REST Api を使用してサーバーに配置すると正常に動作し、/maincontentindex/rendition/_mapping を呼び出すと、上記の構造が取得されます (データがなくても)。

しかし、ディレクトリを使用すると、404 が返され、何かを挿入すると、通常の動的マッピングになります。

4

1 に答える 1