Browse Source

elasticsearch: Fix serializing document id.

Acey9 8 năm trước cách đây
mục cha
commit
3f2ce9488a
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      celery/backends/elasticsearch.py

+ 2 - 1
celery/backends/elasticsearch.py

@@ -4,6 +4,7 @@ from __future__ import absolute_import, unicode_literals
 from datetime import datetime
 from kombu.utils.url import _parse_url
 from celery.exceptions import ImproperlyConfigured
+from celery.five import string
 from .base import KeyValueStoreBackend
 try:
     import elasticsearch
@@ -104,7 +105,7 @@ class ElasticsearchBackend(KeyValueStoreBackend):
 
     def _index(self, id, body, **kwargs):
         return self.server.index(
-            id=id,
+            id=string(id),
             index=self.index,
             doc_type=self.doc_type,
             body=body,