ddnexus / flex

The ultimate ruby client for elasticsearch.
http://ddnexus.github.io/flex/doc/
72 stars 15 forks source link

Elasticsearch responses no longer return the 'ok' return value #28

Open motorstreak opened 10 years ago

motorstreak commented 10 years ago

Noticed this issue when bulk updates were reported as failed despite completing successfully. Reference: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/_return_values.html

Possible update required to Flex::Result::Bulk failed/successful methods (code below)

  def failed
    self['items'].reject{|i| i['index']['status'].between?(200,226) }
  end

  def successful
    self['items'].select{|i| i['index']['status'].between?(200,226) }
  end
ddnexus commented 10 years ago

I see. If you tried that code and it works for both the legacy response and the new one, would you mind submitting a pull request? Thanks.