简体   繁体   English

Elasticsearch子映射

[英]Elasticsearch Child Mapping

I haven't not been able to find the answer to this question anywhere, so I'll try my luck here. 我还没有在任何地方找到该问题的答案,所以我会在这里尝试好运。

I know that I can map fields to a specific type in ES and that works well. 我知道我可以将字段映射到ES中的特定类型,并且效果很好。

But say I have an data set: 但是说我有一个数据集:

{
    "main":{
        "field1": "test",
        "field2": 1,
        .
        .
        .
    }
}

Where the fields in main are arbitrary and change per document. 其中main中的字段是任意的,并且随文档而变化。 What I cant seem to find is if there is a way to map all fields no matter what type they are inside main, to text. 我似乎找不到的是,是否有一种方法可以将所有字段(无论它们在main内部是什么类型)都映射到文本。 I can get it work if i explicitly map every fields, but the fields change and can be added at any time, so I can not possibly map them all. 如果我显式映射每个字段,则可以使它工作,但是这些字段会更改,并且可以随时添加,因此我不可能将它们全部映射。

Dynamic template can be used to map fields dynamically added to specific mapping. 动态模板可用于映射动态添加到特定映射的字段。 Please refer to this documentation . 请参考本文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM