-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
json: cannot unmarshal string into Go struct field ShardFailure._nodes.failures.reason of type map[string]interface {} #1494
Comments
FWIW I had a similar issue in production and due to this error I can't know what actually happened in prod or what kind of failure it was, but the stack trace was similar as the one I reproduced. |
Sad node on the other end ;-) Should be fixed now. |
After upgrading to 7.0.25, it reports an error here “cannot unmarshal object into Go struct field FailedNodeException._shards.failures.reason of type string” my elasticsearch version is 7.10.1 |
@zhaozong Oh my, seems like Elasticsearch has a breaking change in the response structure then, in a minor version update. I will look into this, but it looks like we can't change it nicely and make everyone happy. |
We had to revert to .24 for now, using ES 7.12.1 |
That's unfortunate. I will look into an alternative for the next release. The problem is that it probably would be a breaking change for anyone :-( |
Ah damn, what's the breaking change ? btw it was on a single (healthy) node. Let me know if you need me to run some tests ! ( https://github.com/LeakIX/yql-elastic , matching a single term (like |
This commit adds a few more test cases for happy/unhappy responses of Cluster Stats API across different ES 7.x versions. We also added a Docker Compose file to start a cluster in a specific version. See #1494
The issue seems to be that there are different kinds of errors returned in a similar structure. Some operations return expections on the shard-level ( Worse is that I can only find this in the failure case, because only then the Any fully runnable and reproducible test case will help. |
Ok, so in my case : There was an error before. I'm using an highlighter and here's the query exchange :
Can we return the results AND the error ? It's a breaking change but it could makes sense. You won't have to check |
@gboddin OK, that's helpful. I was looking at how Cluster Stats API changed, but my change affected other locations in the code as well. Thanks for the example. The I wasn't aware of that, hence I broke it in 7.0.25. I have a version that will revert the change in 7.0.25 and still make Cluster Stats API work fine. But I fear that there might be more locations in the code where I'm using the wrong |
Done, It's returning the results, err is Thanks ! |
Thanks @gboddin. Will release 7.0.26 in a minute that will hopefully fix this issue. |
Thank you so much. ( For the fix and the awesome library ! ) |
This commit fixes a change in the cluster stats response structure. Close olivere#1494
This commit adds a few more test cases for happy/unhappy responses of Cluster Stats API across different ES 7.x versions. We also added a Docker Compose file to start a cluster in a specific version. See olivere#1494
This commit fixes a few issues regarding different response structures with a `failures` property. E.g. the `_shards` response structure has a `failures` property which returns different failures for the `reason` property than the `failures[x].reason` property of `_nodes` (returned from Cluster Stats API). I was confused due to this and messed up 7.0.25 because of it. This hopefully fixes olivere#1494.
Please use the following questions as a guideline to help me answer
your issue/question without further inquiry. Thank you.
Which version of Elastic are you using?
[x] elastic.v7 (for Elasticsearch 7.x)
[ ] elastic.v6 (for Elasticsearch 6.x)
[ ] elastic.v5 (for Elasticsearch 5.x)
[ ] elastic.v3 (for Elasticsearch 2.x)
[ ] elastic.v2 (for Elasticsearch 1.x)
Please describe the expected behavior
When calling
client.ClusterStats().Do(ctx)
on a cluster with a failing Node I expect do get a validClusterStatsResponse
.The response from the cluster for
/_cluster/stats
is :Please describe the actual behavior
ClusterStatsResponse is failing unmarshalling with the error:
json: cannot unmarshal string into Go struct field ShardFailure._nodes.failures.reason of type map[string]interface {}
Any steps to reproduce the behavior?
Launch a 2 node elasticsearch cluster, kill -9 the master node, ask the other node how it feels :)
The text was updated successfully, but these errors were encountered: