如何使用弹性搜索RestHighLevelClient在Java中编写json映射?

问题描述 投票:1回答:1

我有下面的映射,想知道如何使用RestHighLevelClient在Java中编写相同的映射

{
  "mappings": {
    "properties": {
      "events": {
        "type": "nested",
        "properties": {
          "ecommerceData": {
            "type": "nested",
            "properties": {
              "comments": {
                "type": "nested",
                "properties": {
                  "recommendationType": {
                    "type": "keyword"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
java elasticsearch elastic-stack elasticsearch-5
1个回答
0
投票

最简单的创建方式(作为其嵌套方式)是将此映射放入文件的JSON format中,然后以字符串格式(提供的实用程序方法)读取它,并如下所示创建映射:

© www.soinside.com 2019 - 2024. All rights reserved.