bitemyapp / bloodhound

Haskell Elasticsearch client and query DSL
bitemyapp.com
BSD 3-Clause "New" or "Revised" License
424 stars 118 forks source link

bulk prepends a newline #141

Open lloucas-imvu opened 8 years ago

lloucas-imvu commented 8 years ago

When using the bulk function, it seems to encode bulk operations with a preceding newline. This is rejected by elasticsearch.

Host: HOST OMITTED
Accept-Encoding: gzip
Content-Length: 731

{"index":{"_type":"events","_id":"21400038-2e15-40df-8994-720397eb35e9","_index":"hsweb-2016-09-28"}}
{JSON_PAYLOAD_OMITTED}

It appears that having that extra newline between the last header and the first actual body makes elastic search reject the request

I have worked around it by using the requestHook functionality in the bhEnv

bitemyapp commented 8 years ago

@lloucas-imvu First, my condolences.

This is rejected by elasticsearch.

Which version?

lloucas-imvu commented 8 years ago

I was informed that we are on elasticsearch 2.0. I understand that this is not a supported version. Seems weird that it would change between versions and not appear in any documentation.

The workaround is a bit ugly, but thanks to the requestHook in bhEnv, easy to implement.

bitemyapp commented 8 years ago

I understand that this is not a supported version. Seems weird that it would change between versions and not appear in any documentation.

Boy are you in for a surprise with Elasticsearch.

bitemyapp commented 8 years ago

Anyhoodle, if there's a benign fix that deals with this for 1.x/2.x without breaking anything, that's fine. 2.x compatibility/migration story is still being figured out by the interested parties.

To be honest, it'll get a proper fix fastest if you PR it. If you don't have time, that's fine, just sayin'.

lloucas-imvu commented 8 years ago

Ill see if i can find the time/setup to try it against both 1.X and 2.X