GetIndex() Unable to Deserialize Response for Certain Alias Filters
See original GitHub issueNEST/Elasticsearch.Net version: 6.8.3 Elasticsearch version: 6.8.3 Description of the problem including expected versus actual behavior:
I’m having an issue with NEST loading index using await client.GetIndexAsync(indexName)
method if the index has alias setup with certain filter format. Cluster accepts the filter, but NEST client fails.
Alias with filter:
{ "actions": [
{
"add": {
"index": ".es-test-repro",
"alias": ".es-test-repro-alias1",
"filter": {
"bool": { "must_not": { "exists": { "field": "field1" } } }
}
}
} ]
}
Error:
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[Nest.QueryContainer]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path '['.es-test-repro'].aliases['.es-test-repro-alias1'].filter.bool.must_not.exists', line 1, position 90.
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[Nest.QueryContainer]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path '['.es-test-repro'].aliases['.es-test-repro-alias1'].filter.bool.must_not.exists', line 1, position 90.
Repro project: https://github.com/opnarius/nest-alias-filter-repro
I can get around the error by reformatting the filter as follow:
"filter": {
"bool":
{
"must_not": [ { "exists": { "field": "field1" } } ]
}
}
Should Nest support this alias filter if cluster is allowing it?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Elasticsearch .NET v6.8.4 release notes (2020-02-25) | LibHunt
#4311 GetIndex() Unable to Deserialize Response for Certain Alias Filters; #4387 Unable to initialize ConnectionConfiguration in certain conditions ...
Read more >Failed to add alias . filter - how to solve related issues
An alias is a way to associate one or more indices with a single name, and filters can be used to limit the...
Read more >Elasticsearch DSL Documentation
Elasticsearch DSL is a high-level library whose aim is to help with writing and running queries against Elasticsearch.
Read more >Percolate query | Elasticsearch Guide [8.9]
It indicates which documents matched with a particular percolator query. ... Based on the response from an index request, the _id and other...
Read more >Edm.ComplexType: Deserialization failed. Expected value: ...
Document retrieval API throws an error when trying to deserialize the response received from the Azure Search. "AssignedTo": { "Alias": " ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, we support all responses from the cluster, regardless of their initial origin.
From your description this sounds like a bug in the client, where we need to be more lenient in instances where the server has accepted the
must_not
as an object, and not an array.Thanks for the repro, that will make it easier to fix.
Closing ticket as PR https://github.com/elastic/elasticsearch-net/pull/4322 was merged.