From 3e884fa4a29f6418cb7d0fad624d272972bf29b8 Mon Sep 17 00:00:00 2001 From: Frank <1018433655@qq.com> Date: Thu, 26 Dec 2019 10:04:31 +0800 Subject: [PATCH] Update es_pandas.py --- es_pandas/es_pandas.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/es_pandas/es_pandas.py b/es_pandas/es_pandas.py index 200847c..c510964 100644 --- a/es_pandas/es_pandas.py +++ b/es_pandas/es_pandas.py @@ -80,11 +80,9 @@ def to_pandas(self, index, query_rule={'query': {'match_all': {}}}, heads=[], dt else: # Fix es client unrecongnized parameter 'include_type_name' bug for es 6.x mapping = self.ic.get_mapping(index=index) - keys = list(mapping[index]['mappings'].keys()) - if len(keys) > 2: raise Exception('Multi templates exits: %s' % (','.join(keys))) - tmp = mapping[index]['mappings'][keys[1]]['properties'] - del mapping[index]['mappings'][keys[1]] - mapping[index]['mappings']['properties'] = tmp + key = [k for k in mapping[index]['mappings'].keys() if k != '_default_'] + if len(keys) > 1: raise Exception('No templates exits: %s' % index) + mapping[index]['mappings']['properties'] = mapping[index]['mappings'][key[0]]['properties'] if len(heads) < 1: heads = [k for k in mapping[index]['mappings']['properties'].keys()] else: