Skip to content
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

Unmarshal error of parsing shards failures in SearchResult #291

Open
nodestory opened this issue Jan 13, 2017 · 0 comments
Open

Unmarshal error of parsing shards failures in SearchResult #291

nodestory opened this issue Jan 13, 2017 · 0 comments

Comments

@nodestory
Copy link

The field ShardStatus of SearchResult contains the field Failure which is defined as follows:

type Failure struct {
    Index  string    `json:"index"`
    Shard  StatusInt `json:"shard"`
    Reason string    `json:"reason"`
}

But actually I got the failure in the response like this when scrolling the results:

{
    "shard": -1,
    "index": null,
    "reason": {
      "type": "es_rejected_execution_exception",
      "reason": "..."
    }
}

So every time if some shards fail, I'll get an error json: cannot unmarshal object into Go value of type string from here.

It seems that Reason should be a struct with two string fields type and reason, but I'm not sure if the response format depends on the version of Elasticsearch (currently I'm using 2.2.2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant