fix: 修复命令存储es失效时, 会话、命令记录列表创建和查看失败的问题

pull/8922/head
Jiangjie.Bai 2022-09-28 16:10:41 +08:00
parent 1c8ad40565
commit df2858470a
1 changed files with 8 additions and 3 deletions

View File

@ -184,9 +184,14 @@ class CommandStore(object):
return Command.from_multi_dict(source_data)
def count(self, **query):
body = self.get_query_body(**query)
data = self.es.count(index=self.query_index, doc_type=self.doc_type, body=body)
return data["count"]
try:
body = self.get_query_body(**query)
data = self.es.count(index=self.query_index, doc_type=self.doc_type, body=body)
count = data["count"]
except Exception as e:
logger.error('ES count error: {}'.format(e))
count = 0
return count
def __getattr__(self, item):
return getattr(self.es, item)