Search code examples
c#elasticsearchnest

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.

Now all my code has changed to respect the No type rule implemented in the new version BUT.. in some methodes (Like :

 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 :

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

Now, I don't know how to make my ElasticClient create the same request, or get the response I'm waiting for. Ill appreciate any help, thank you


Solution

  • 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 ? Because after the version 7 Elastic search eliminated the Types. 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. 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<>