Permalink
Browse files

Fix for breaking change in elasticsearch 1.0. fixes #4.

  • Loading branch information...
1 parent 12b3a2b commit d8deb3eeefafc50226f5905bbce410ce883a36f8 Barnaby Gray committed Feb 22, 2014
Showing with 3 additions and 4 deletions.
  1. +2 −3 logcabin/outputs/elasticsearch.py
  2. +1 −1 test/test_outputs.py
@@ -44,10 +44,9 @@ def process(self, event):
for retry in xrange(self.RETRIES):
try:
res = urllib2.urlopen(url, data=data)
+ # 200 response indicates all is well
+ success = True
result = json.load(res)
- success = result['ok']
- if not success:
- self.logger.error('Indexing failed: %s' % result)
break
except urllib2.HTTPError as ex:
if ex.getcode() == 400:
View
@@ -55,7 +55,7 @@ class ElasticsearchTests(OutputTests):
def test_log(self):
with mock.patch('urllib2.urlopen') as urlopen_mock:
- urlopen_mock.return_value.read.return_value = json.dumps({'_type': 'event', '_id': 'w0HnGYHFSOS7EBIWnxBcEg', 'ok': True, '_version': 1, '_index': 'test'})
+ urlopen_mock.return_value.read.return_value = json.dumps({'_type': 'event', '_id': 'w0HnGYHFSOS7EBIWnxBcEg', '_version': 1, '_index': 'test'})
i = self.create({'index': 'test', 'type': 'event'})
self.input.put(Event(field='x'))

0 comments on commit d8deb3e

Please sign in to comment.