Elasticsearch support broken for versions later than 1.6
Hi,
When trying to send metadata to elasticsearch versions later than 1.6 the bulk update API call fails due to the refresh parameter being present - see this issue
I see this responsewith sysdig when running against elasticsearch 2.1
POST /_bulk HTTP/1.1..Host: 192.168.99.100:32769..User-Agent: elasticSearch/0.0.2 (linux-amd64)..Transfer-Encoding: chunked..Accept: application/json..Accept-Encoding: gzip....1..{..5fed..\"index\":{\"_index\":\"gor\",\"_type\":\"RequestResponse\",\"_timestamp\":\"1449654187376\",\"refresh\":true}}.....
Bad Request..Content-Type: application/json; charset=UTF-8..Content-Length: 265....{\"error\":{\"root_cause\":[{\"type\":\"illegal_argument_exception\",\"reason\":\"Action/metadata line [1] contains an unknown parameter [refresh]\"}],\"type\":\"illegal_argument_exception\",\"reason\":\"Action/metadata line [1] contains an unknown parameter [refresh]\"},\"status\":400}
Any ideas how to fix that? Frankly i'm not using ES, and integration was made by community.
I locally modified ./elastigo/core/index.go and ./elastigo/core/bulk.go to comment out following code
if refresh { values.Add("refresh", "true") }
After that point gor started sending data to elastic serach. But then I came across other issues like
- Method & URL are not calculated correctly because now request data includes id and timestamp as first line
- Elastic search shows all values as garbled (hex of byte[]). Not sure whether its intended or something is wrong with my elastic search setup. I locally modified gor/elasticsearch.go to update ESRequestResponse to use string instead of byte[] to fix this issue
- As its being executed part of output_http.go, elastic search has access only to replayed requests & responses and not all requests. Not sure whether its intended or I am doing something wrong.
I am planning to create elastic search based middleware to avoid these issues. @buger, I am planning to combine worker logic from output_http.go to elastic.go pieces in my middleware. Is that a good approach? Do you think I should explore some alternatives before walking on to this path?
Sorry for the late response! ElasticSeach integration definitely broken right now, and i do not have estimates when I can fix it (contributions highly welcome), but this is definitly on my list.
Fixed now https://github.com/buger/gor/wiki/Exporting-to-ElasticSearch