Skip to content

Commit

Permalink
Update es_pandas.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fuyb1992 authored Dec 26, 2019
1 parent 0ded1c9 commit 3e884fa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions es_pandas/es_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3e884fa

Please sign in to comment.