Skip to content

Commit 7e6ffaa

Browse files
committed
v2.1.4 Work with multiple client versions
1 parent b4ea00e commit 7e6ffaa

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tableschema_elasticsearch/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.3
1+
2.1.4

tableschema_elasticsearch/storage.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import uuid
1212

1313
import logging
14-
from elasticsearch import Elasticsearch
14+
from elasticsearch import Elasticsearch, __version__ as es_version
1515
from elasticsearch.helpers import streaming_bulk
1616
from elasticsearch.exceptions import RequestError
1717

@@ -79,7 +79,10 @@ def put_mapping(self, bucket, descriptor, index_name, mapping_generator_cls):
7979
mapping = mappers.descriptor_to_mapping(
8080
descriptor, mapping_generator_cls=mapping_generator_cls
8181
)
82-
self.__es.indices.put_mapping(index=index_name, **mapping)
82+
if es_version[0] < 8:
83+
self.__es.indices.put_mapping(index=index_name, body=mapping)
84+
else:
85+
self.__es.indices.put_mapping(index=index_name, **mapping)
8386

8487
def generate_doc_id(self, row, primary_key):
8588
return '/'.join([str(row.get(k)) for k in primary_key])

0 commit comments

Comments
 (0)