简体   繁体   English

ElasticSearch C#:升级到 Nest Version7.0 后,从 HEAD 上成功的 (404) 低级别调用构建的无效 NEST 响应

[英]ElasticSearch C# : after upgrade to Nest Version7.0, Invalid NEST response built from a successful (404) low level call on HEAD

I have upgraded my Nest to a newer version 7.X on my C# dotnetCore project.我已经在我的 C# dotnetCore 项目中将我的 Nest 升级到了更新的 7.X 版本。

Now all my code has changed to respect the No type rule implemented in the new version BUT.. in some methodes (Like:现在我的所有代码都已更改为尊重新版本中实现的 No type 规则,但在某些方法中(如:

 ElasticClient.DocumentExistsAsync<T>(id)

), I'm no longer able to get the response from ElasticSearch, instead I get: Invalid NEST response built from a successful (404) low level call on HEAD and when checking on the logs I see that the request is created this way: ),我不再能够从 ElasticSearch 获得响应,而是得到:从 HEAD 上成功的 (404) 低级别调用构建的无效 NEST 响应,并且在检查日志时,我看到请求是以这种方式创建的:

IndexName/_doc/id

when checking on Kibana this request is not valid instead I have to change it to IndexName/myType/id so that it can works在检查 Kibana 时,此请求无效,而是我必须将其更改为IndexName/myType/id以便它可以工作

Now, I don't know how to make my ElasticClient create the same request, or get the response I'm waiting for.现在,我不知道如何让我的 ElasticClient 创建相同的请求,或者得到我正在等待的响应。 Ill appreciate any help, thank you非常感谢任何帮助,谢谢

SOLUTION: For the record and FYI.解决方案:供记录和仅供参考。 it's not possible to use the native NEST methodes (GET, Exist, ExistDoc...) from a nest library Version 7.X when the Elastic search you have in your server has a version 6.X Why is that?当您的服务器中的弹性搜索具有 6.X 版本时,无法使用嵌套库 7.X 版本中的本机 NEST 方法(GET、Exist、ExistDoc...)为什么会这样? Because after the version 7 Elastic search eliminated the Types.因为在版本 7 之后,弹性搜索消除了类型。 so when you create a request from a (6.x) library it take in consideration the Type associated with the request, it becomes something like IndexName/myType/id but in the ESv7.x there is no myType in the request instead you will always find _doc like: IndexName/_doc/id which doesn't represent the Type but only the routing to the doc.因此,当您从 (6.x) 库创建请求时,它会考虑与请求关联的类型,它变成类似于IndexName/myType/id但在 ESv7.x 中请求中没有myType而您将总是找到像: IndexName/_doc/id _doc的_doc,它不代表类型,而只是路由到文档。 So conclusion: If you upgrade your ES server => upgrade your libraries If you upgrade your library and you don't have problem with upgrading the ES server => upgrade the ES server If you have issues, you can still upgrade the library but don't use the native methode, instead use .Search<>所以结论:如果你升级你的ES服务器=>升级你的库如果你升级你的库并且升级ES服务器没有问题=>升级ES服务器如果你有问题,你仍然可以升级库但是不要'不要使用本机方法,而是使用.Search<>

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

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