question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GetIndex() Unable to Deserialize Response for Certain Alias Filters

See original GitHub issue

NEST/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:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
codebraincommented, Jan 21, 2020

Should Nest support this alias filter if cluster is allowing it?

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.

0reactions
codebraincommented, Feb 3, 2020
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found