简体   繁体   English

弹性搜索 rest 高级客户端出现以下错误

[英]Getting below error in elastic search rest high level client

I am getting below error when i try to create the mapping using create index request.当我尝试使用创建索引请求创建映射时,出现以下错误。

Elasticsearch exception [type=mapper_parsing_exception, reason=Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [recommendations: {recommendations={properties={events={type=nested, properties={recommendationData={type=nested, properties={recommendations={type=nested, properties={recommendationType={type=keyword}}}}}}}}}}]] Elasticsearch 异常 [type=mapper_parsing_exception,reason=Failed to parse mapping [_doc]:根映射定义有不受支持的参数:[建议:{recommendations={properties={events={type=nested, properties={recommendationData={type=nested , 属性={recommendations={type=nested, properties={recommendationType={type=keyword}}}}}}}}}}]]

and the mapping is并且映射是

{
  "mappings": {
    "recommendations": {
      "properties": {
        "events": {
          "type": "nested",
          "properties": {
            "recommendationData": {
              "type": "nested",
              "properties": {
                "recommendations": {
                  "type": "nested",
                  "properties": {
                    "recommendationType": {
                      "type": "keyword"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

and the java code is和 java 代码是

private void checkAndCreateDocumentMapping() throws IOException {

        CreateIndexRequest createIndexRequest = new CreateIndexRequest(this.getIndexName());
        String indexString = getStringFromFile("nested" + ".mapping");
        createIndexRequest.source(indexString, XContentType.JSON);
        client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
    }

Please note that elasticsearch no more support multiple mappings therefore it is no more required to pass mapping name.请注意 elasticsearch 不再支持多个映射,因此不再需要传递映射名称。 Assuming recommendations is name of mapping, it can be instead used as name of index.假设recommendations是映射的名称,它可以被用作索引的名称。 Therefore correct dsl to create index should be,因此,创建索引的正确 dsl 应该是,

PUT recommendations
{
  "mappings": {
    "properties": {
      "events": {
        "type": "nested",
        "properties": {
          "recommendationData": {
            "type": "nested",
            "properties": {
              "recommendations": {
                "type": "nested",
                "properties": {
                  "recommendationType": {
                    "type": "keyword"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

暂无
暂无

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

相关问题 弹性搜索:将客户端传输到高级其余客户端 - Elastic Search: Transport Client to High Level Rest Client Spring 数据弹性搜索与 Java 高级 REST 客户端 - Spring Data Elastic Search vs Java High Level REST Client 为什么在弹性搜索中引入 Java 高级 REST 客户端? - Why Java High Level REST Client got introduced in Elastic search? 将映射与 Elastic Search 的高级 REST JAVA 客户端异步放置 - 不推荐使用的错误 - Put mapping with Elastic Search's High level REST JAVA client asynchronously - deprecated error 如何通过 Java 高级 rest 客户端在 Elastic Search 中使用多个字段进行搜索 - How to search using multiple fields in Elastic Search through Java high level rest client 如何使用 JAVA 高级 REST 客户端创建弹性搜索索引? - How can I create an elastic search index with the JAVA high level REST client? 如何在 Elastic High Level Rest 客户端中使用 search_after 进行分页 - How to use search_after in Elastic High Level Rest Client for pagination 为什么 filterQuery 在用于 JAVA 的 Elastic Search 的高级 REST 客户端中不起作用? - Why does filterQuery not work in Elastic Search's high level REST client for JAVA? 使用 Rest 高级客户端检索或插入数据到 Elastic Search 时出现 SocketTimeoutException - SocketTimeoutException while retrieving or inserting data into Elastic Search by using Rest High Level Client 如何通过 Java 高级 Rest 客户端访问安全弹性搜索 - How to hit Secure Elastic Search through Java High Level Rest Client
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM