Closed niemyjski closed 5 years ago
Hi @niemyjski,
The GetIndicesPointingToAliasAsync
is an extension method as defined here:
This extension method will throw exceptions (r => r.ThrowExceptions()
) if the server returns a 404
- as is the case with a missing alias.
If you want finer control as to throwing exceptions and handling empty collections I would recommend using the client.Indices.GetAliasAsync
method on the client directly.
The GetAliasNotFoundApiTests
test illustrates the behaviour of this method in the event of a 404
from a missing alias:
Hopefully this clarifies the behaviour!
I think @niemyjski opened this because of a possible change in behaviour moving from 6.x
Yeah, I opened it because it was a change from 5.x, also go to definition doesn't even show it as an extension for that (that might be bug in rider), it literally pointed me to the code above (weird)
This should be fixed once #3873 lands
Thanks for your help, any eta for the beta release?
Closing as #3873 has been merged, this should therefore be fixed in the next 7.0.0 release. We are going to be releasing the GA client very shortly.
Please keep an eye on the https://github.com/elastic/elasticsearch-net/releases
Thanks @niemyjski
Using latest stable elastic and 7.0 beta nest client calling
await client.GetIndicesPointingToAliasAsync("non-existent-alias")
will throw an exception instead of returning an empty collection.Looking at the code it seems like it should be returning an empty collection (something that I think we were expecting in the old release).