mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-06-24 14:02:01 +00:00
fix: 添加新的 es 时创建索引
This commit is contained in:
parent
c6bb9e97fb
commit
7d7da9bf98
@ -76,10 +76,23 @@ class CommandStore():
|
|||||||
self._ensure_index_exists()
|
self._ensure_index_exists()
|
||||||
|
|
||||||
def _ensure_index_exists(self):
|
def _ensure_index_exists(self):
|
||||||
|
mappings = {
|
||||||
|
"mappings": {
|
||||||
|
"properties": {
|
||||||
|
"session": {
|
||||||
|
"type": "keyword"
|
||||||
|
},
|
||||||
|
"org_id": {
|
||||||
|
"type": "keyword"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.es.indices.create(self.index)
|
self.es.indices.create(self.index, body=mappings)
|
||||||
except RequestError:
|
except RequestError as e:
|
||||||
pass
|
logger.exception(e)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def make_data(command):
|
def make_data(command):
|
||||||
|
Loading…
Reference in New Issue
Block a user