From 99e1b2cf92f419902c37aa1884d36b7be6fd90de Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Wed, 18 May 2022 19:52:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8D=E6=94=AF=E6=8C=81es8=20?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/locale/ja/LC_MESSAGES/django.mo | 4 ++-- apps/locale/ja/LC_MESSAGES/django.po | 4 ++++ apps/locale/zh/LC_MESSAGES/django.mo | 4 ++-- apps/locale/zh/LC_MESSAGES/django.po | 4 ++++ apps/terminal/backends/command/es.py | 14 ++++++++++++-- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/apps/locale/ja/LC_MESSAGES/django.mo b/apps/locale/ja/LC_MESSAGES/django.mo index b6af2bdf7..29bcfa164 100644 --- a/apps/locale/ja/LC_MESSAGES/django.mo +++ b/apps/locale/ja/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:843b6dffe6af09073053e21f65be4c8264e6dee05509b375c8191dde8c9079b6 -size 127386 +oid sha256:5effe3cb5eb97d51bf886d21dfbe785bb789722f30774a6595eac7aa79b6315a +size 127478 diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index 6b97b95d0..c976bf085 100644 --- a/apps/locale/ja/LC_MESSAGES/django.po +++ b/apps/locale/ja/LC_MESSAGES/django.po @@ -4651,6 +4651,10 @@ msgstr "ターミナル管理" msgid "Invalid elasticsearch config" msgstr "無効なElasticsearch構成" +#: terminal/backends/command/es.py:33 +msgid "Not Support Elasticsearch8" +msgstr "サポートされていません Elasticsearch8" + #: terminal/backends/command/models.py:16 msgid "Ordinary" msgstr "普通" diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index 88b5034ea..317e02a96 100644 --- a/apps/locale/zh/LC_MESSAGES/django.mo +++ b/apps/locale/zh/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a78975a5a6669bfcc0f99bc4d47811be82a0620e873e51e4a17d06548e3b1e7f -size 105269 +oid sha256:d30f8d3abc215c35bb2dd889374eeef896a193f8010ccd5ae8e27aa408f045c7 +size 105337 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 20a071d1c..8dee918fb 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -4579,6 +4579,10 @@ msgstr "终端管理" msgid "Invalid elasticsearch config" msgstr "无效的 Elasticsearch 配置" +#: terminal/backends/command/es.py:33 +msgid "Not Support Elasticsearch8" +msgstr "不支持 Elasticsearch8" + #: terminal/backends/command/models.py:16 msgid "Ordinary" msgstr "普通" diff --git a/apps/terminal/backends/command/es.py b/apps/terminal/backends/command/es.py index 997bd30fd..ae76b2974 100644 --- a/apps/terminal/backends/command/es.py +++ b/apps/terminal/backends/command/es.py @@ -28,6 +28,11 @@ class InvalidElasticsearch(JMSException): default_detail = _('Invalid elasticsearch config') +class NotSupportElasticsearch8(JMSException): + default_code = 'not_support_elasticsearch8' + default_detail = _('Not Support Elasticsearch8') + + class CommandStore(object): def __init__(self, config): self.doc_type = config.get("DOC_TYPE") or '_doc' @@ -68,13 +73,18 @@ class CommandStore(object): if not self.ping(timeout=3): return False + info = self.es.info() + version = info['version']['number'].split('.')[0] + + if version == '8': + raise NotSupportElasticsearch8 + try: # 获取索引信息,如果没有定义,直接返回 data = self.es.indices.get_mapping(self.index) except NotFoundError: return False - info = self.es.info() - version = info['version']['number'].split('.')[0] + try: if version == '6': # 检测索引是不是新的类型 es6