Skip to content

Empty bulk request gives weird ElasticSearch error #279

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

Closed
q42jaap opened this issue Jun 4, 2013 · 0 comments
Closed

Empty bulk request gives weird ElasticSearch error #279

q42jaap opened this issue Jun 4, 2013 · 0 comments

Comments

@q42jaap
Copy link
Contributor

q42jaap commented Jun 4, 2013

I didn't realize that my bulk request was empty. NEST sent a completely empty request:

Request:

POST http://127.0.0.1:9200/_bulk HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: 127.0.0.1:9200
Content-Length: 0

Response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=UTF-8
Content-Length: 86

{"error":"Failed to derive xcontent from org.elasticsearch.common.bytes.BytesArray@0"}

Code:

client.Bulk(bulk => {
    foreach (var x in xxx)
    {
      bulk.Index<X>(index => index
        .Object(x));
    }
    return bulk;
});

It might be a good idea for NEST to intercept this case and generate a better error... It also might be a breaking (since NEST doesn't throw exceptions right now)...

@Mpdreamz Mpdreamz mentioned this issue Jun 10, 2013
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