带有映射的创建索引的问题 [英] Issue with create index with mapping

查看:85
本文介绍了带有映射的创建索引的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Elastic search版本7.1.0和NEST 6.7.0与Elasticsearch.Net 6.7.0一起使用. 在尝试创建索引时,出现错误.

I'm using elastic search version 7.1.0 and NEST 6.7.0 with Elasticsearch.Net 6.7.0. While I'm trying to create an index I've got an error.

这是我的代码,我在NEST和Elasticsearch.Net 6.4.0版本上使用了相同的代码,并且运行正常

This is my code, I was using the same code on NEST and Elasticsearch.Net version 6.4.0 and it was working fine

var result =   Client.CreateIndex(DefaultIndex, c => c
                .Settings(s => s
                    .NumberOfShards(numberOfShards)
                    .NumberOfReplicas(numberOfReplicas)
                    .BlocksReadOnly(false)
                )
                .Mappings(m => m
                    .Map<SearchDocument>(mm => mm
                        .AutoMap(3)
                    )
                )
            );

这是我得到的错误

无效的NEST响应是由对PUT的不成功的低级调用生成的: /local_brainbank_index

Invalid NEST response built from a unsuccessful low level call on PUT: /local_brainbank_index

  • [1] BadResponse:节点: http://localhost:9200/接收:00:00:00.2880040

    OriginalException:Elasticsearch.Net.ElasticsearchClientException:远程服务器返回错误:(400)错误的请求..呼叫:状态

  • [1] BadResponse: Node: http://localhost:9200/ Took: 00:00:00.2880040

    OriginalException: Elasticsearch.Net.ElasticsearchClientException: The remote server returned an error: (400) Bad Request.. Call: Status

代码400,来自:PUT/local_brainbank_index. ServerError:类型: mapper_parsing_exception原因:无法解析映射[_doc]:根 映射定义包含不受支持的参数:[searchdocument: {properties = {sourceId = {type = integer},sourceType = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, authorName = {type = text,字段= {keyword = {ignore_above = 256, type = keyword}}},subject = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, imageURL = {类型=文字,字段= {关键字= {ignore_above = 256, type = keyword}}},id = {type = text,fields = {keyword = {ignore_above = 256, type = keyword}}},sourceName = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}},正文= {类型=文字, 字段= {关键字= {ignore_above = 256,类型=关键字}}},uRL = {类型=文本, field = {keyword = {ignore_above = 256,type = keyword}}}}}]"CausedBy: 类型:mapper_parsing_exception原因:"根映射定义具有 不支持的参数:[searchdocument: {properties = {sourceId = {type = integer},sourceType = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, authorName = {type = text,字段= {keyword = {ignore_above = 256, type = keyword}}},subject = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, imageURL = {类型=文字,字段= {关键字= {ignore_above = 256, type = keyword}}},id = {type = text,fields = {keyword = {ignore_above = 256, type = keyword}}},sourceName = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}},正文= {类型=文字, 字段= {关键字= {ignore_above = 256,类型=关键字}}},uRL = {类型=文本, 字段= {关键字= {ignore_above = 256,类型=关键字}}}}}]""---> System.Net.WebException:远程服务器返回错误:(400) 错误的请求.在System.Net.HttpWebRequest.GetResponse()在 Elasticsearch.Net.HttpWebRequestConnection.Request [TResponse](RequestData requestData)---内部异常堆栈跟踪的结尾---

code 400 from: PUT /local_brainbank_index. ServerError: Type: mapper_parsing_exception Reason: "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]" CausedBy: "Type: mapper_parsing_exception Reason: "Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]"" ---> System.Net.WebException: The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse() at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData) --- End of inner exception stack trace ---

请求:

{"mappings":{"searchdocument":{"properties":{"id":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"sourceType":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"sourceId":{"type":"integer"},"sourceName":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"authorName":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"subject":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"body":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"uRL":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"imageURL":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}},"settings":{"index.number_of_replicas":0,"index.blocks.read_only":false,"index.number_of_shards":1}}

响应:

{错误":{"root_cause":[{类型":"mapper_parsing_exception",原因":根 映射定义包含不受支持的参数:[searchdocument: {properties = {sourceId = {type = integer},sourceType = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, authorName = {type = text,字段= {keyword = {ignore_above = 256, type = keyword}}},subject = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, imageURL = {类型=文字,字段= {关键字= {ignore_above = 256, type = keyword}}},id = {type = text,fields = {keyword = {ignore_above = 256, type = keyword}}},sourceName = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}},正文= {类型=文字, 字段= {关键字= {ignore_above = 256,类型=关键字}}},uRL = {类型=文本, 字段= {关键字= {ignore_above = 256, type = keyword}}}}}]}]","type":"mapper_parsing_exception",原因":失败 解析映射[_doc]:根映射定义不受支持 参数:[searchdocument:{properties = {sourceId = {type = integer}, sourceType = {type = text,字段= {keyword = {ignore_above = 256, type = keyword}}},authorName = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, 主题= {类型=文本,字段= {关键字= {ignore_above = 256, type = keyword}}},imageURL = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}},id = {类型=文字, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, sourceName = {type = text,字段= {keyword = {ignore_above = 256, type = keyword}}},body = {type = text,fields = {keyword = {ignore_above = 256, type = keyword}}},uRL = {type = text,fields = {keyword = {ignore_above = 256, type = keyword}}}}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Root 映射定义包含不受支持的参数:[searchdocument: {properties = {sourceId = {type = integer},sourceType = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, authorName = {type = text,字段= {keyword = {ignore_above = 256, type = keyword}}},subject = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}}, imageURL = {类型=文字,字段= {关键字= {ignore_above = 256, type = keyword}}},id = {type = text,fields = {keyword = {ignore_above = 256, type = keyword}}},sourceName = {type = text, 字段= {关键字= {ignore_above = 256,类型=关键字}}},正文= {类型=文字, 字段= {关键字= {ignore_above = 256,类型=关键字}}},uRL = {类型=文本, fields = {keyword = {ignore_above = 256,type = keyword}}}}}}},"状态:400}

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [searchdocument : {properties={sourceId={type=integer}, sourceType={type=text, fields={keyword={ignore_above=256, type=keyword}}}, authorName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, subject={type=text, fields={keyword={ignore_above=256, type=keyword}}}, imageURL={type=text, fields={keyword={ignore_above=256, type=keyword}}}, id={type=text, fields={keyword={ignore_above=256, type=keyword}}}, sourceName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, body={type=text, fields={keyword={ignore_above=256, type=keyword}}}, uRL={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]"}},"status":400}

推荐答案

NEST和Elasticsearch.Net 6.7.0与Elasticsearch 7.x不兼容.请使用NEST和Elasticsearch.Net 7.x,要发布的最新版本为 7.0.0-alpha2 .

NEST and Elasticsearch.Net 6.7.0 are not compatible with Elasticsearch 7.x. Please use NEST and Elasticsearch.Net 7.x, the latest of which to be released is 7.0.0-alpha2 at this time.

这篇关于带有映射的创建索引的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆