java - java:Elasticsearch 异常 [type=mapper_parsing_exception, reason=Failed to parse mapping [_doc]
问题描述
我正在尝试为索引创建动态模板映射,并且不断收到以下错误:
ElasticsearchStatusException[Elasticsearch 异常 [type=mapper_parsing_exception, reason=Failed to parse mapping [_doc]: 根映射定义有不受支持的参数:[doc : {properties={price={type=float}, studymodel={type=keyword}, name ={search_analyzer=ik_smart,analyzer=ik_max_word,type=text},描述={search_analyzer=ik_smart,analyzer=ik_max_word,type=text}}}]];嵌套:ElasticsearchException[Elasticsearch 异常 [type=mapper_parsing_exception,reason=Root 映射定义具有不受支持的参数:[doc:{properties={price={type=float},studymodel={type=keyword},name={search_analyzer=ik_smart,分析器=ik_max_word,类型=文本},描述={search_analyzer=ik_smart,分析器=ik_max_word,类型=文本}}}]]];
这是我试图创建映射的代码:
CreateIndexRequest createIndexRequest = new CreateIndexRequest("xc_course");
createIndexRequest.settings(Settings.builder().put("number_of_shards",1)
.put("number_of_replicas",0));
createIndexRequest.mapping("doc"," {\n" +
" \t\"properties\": {\n" +
" \"name\": {\n" +
" \"type\": \"text\",\n" +
" \"analyzer\":\"ik_max_word\",\n" +
" \"search_analyzer\":\"ik_smart\"\n" +
" },\n" +
" \"description\": {\n" +
" \"type\": \"text\",\n" +
" \"analyzer\":\"ik_max_word\",\n" +
" \"search_analyzer\":\"ik_smart\"\n" +
" },\n" +
" \"studymodel\": {\n" +
" \"type\": \"keyword\"\n" +
" },\n" +
" \"price\": {\n" +
" \"type\": \"float\"\n" +
" }\n" +
" }\n" +
"}", XContentType.JSON);
IndicesClient indices = client.indices();
CreateIndexResponse createIndexResponse = indices.create(createIndexRequest);
boolean acknowledged = createIndexResponse.isAcknowledged();
System.out.println(acknowledged);
这是映射代码中的错误吗?或者这里一切正常,我应该看看解析映射对象的方式?
解决方案
推荐阅读
- c# - 这两个简单的 Async 和 Await 实现之间的输出差异
- .net - .NET Core 在 AzuerAD 身份验证后添加声明
- css - 尽管设置了最小宽度和高度,但溢出在网格列中不起作用
- java - Android 9:虽然有 cleartextTrafficPermitted="true",但不允许明文 HTTP 流量
- ios - UICollectionView 两个具有相同视图的单元格。第二个单元格不显示任何内容
- r - 函数中的 lme 对象使用上一次运行的响应变量
- scikit-learn - Anaconda Scikit-learn 最新版本
- excel - Workbook_BeforeClose() 在第一部分起作用,但不关闭 Workbook
- bash - 在所有子目录中递归运行命令
- deepsecurity - 更新名称存在多次的计算机对象时出现 REST API 错误