Browse Source

fix: 命令记录-导出选择项命令:却导出了所有命令

pull/7081/head
feng626 3 years ago
parent
commit
8a413563be
  1. 18
      apps/terminal/backends/command/es.py

18
apps/terminal/backends/command/es.py

@ -131,10 +131,13 @@ class CommandStore():
index=self.index, doc_type=self.doc_type, body=body, from_=from_, size=size,
sort=sort
)
source_data = []
for item in data['hits']['hits']:
if item:
item['_source'].update({'id': item['_id']})
source_data.append(item['_source'])
return AbstractSessionCommand.from_multi_dict(
[item['_source'] for item in data['hits']['hits'] if item]
)
return AbstractSessionCommand.from_multi_dict(source_data)
def count(self, **query):
body = self.get_query_body(**query)
@ -160,11 +163,16 @@ class CommandStore():
new_kwargs[k] = str(v) if isinstance(v, UUID) else v
kwargs = new_kwargs
index_in_field = 'id__in'
exact_fields = self.exact_fields
match_fields = self.match_fields
match = {}
exact = {}
index = {}
if index_in_field in kwargs:
index['values'] = kwargs[index_in_field]
for k, v in kwargs.items():
if k in exact_fields:
@ -221,6 +229,10 @@ class CommandStore():
'timestamp': timestamp_range
}
}
] + [
{
'ids': {k: v}
} for k, v in index.items()
]
}
},

Loading…
Cancel
Save