mattbaird / elastigo

A Go (golang) based Elasticsearch client library.
Apache License 2.0
943 stars 241 forks source link

'refresh' on BulkIndexer should be a query param, not in action/meta line #215

Closed fcheslack closed 9 years ago

fcheslack commented 9 years ago

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html#bulk-refresh

refresh is supposed to be set per bulk request (I think the only way to do that is via query params). Currently elastigo sets it in the 'action_and_meta_data' line of the body for each bulk action added to the indexer.

I ran into this problem when I upgraded ES from 1.3 to 1.6. I assume older versions ignored unrecognized params, but 1.6 is actually giving me an error when the unrecognized refresh param is included in the body.

I'm not sure if refresh meshes well with the way BulkIndexer works. I guess one approach would be to set a bool on the BulkIndexer that gets flipped on for any action that asks for a refresh, and just include a check/reset for it in the next WriteBulkBytes. It could also just not support refresh and require the application to make an explicit refresh call itself.

fcheslack commented 9 years ago

Looks like my assumption about how 'refresh' is meant to be used was correct https://github.com/elastic/elasticsearch/issues/11690