Skip to content

Commit

Permalink
Merge pull request #59 from certego/develop
Browse files Browse the repository at this point in the history
0.7.4
  • Loading branch information
mlodic authored Nov 16, 2023
2 parents 90c96c5 + 72508c3 commit 60d2078
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions certego_saas/ext/upload/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def upload(
logger.info(f"Uploading {docs.count()} documents")
jsons = map(lambda x: x.to_bulk(), docs)
success, errors = bulk(client, jsons, request_timeout=timeout)
docs.delete()
for doc in docs.iterator():
doc.delete()
return success, errors

def clean(self):
Expand All @@ -68,7 +69,7 @@ def __repr__(self):
from mongoengine import fields as mongo_fields

except ImportError:
from django.db.models import JSONField, Model
from django.db.models import Index, JSONField, Model
from django.db.models import fields as django_fields

class BIDocument(__BIDocumentInterface, Model):
Expand All @@ -78,6 +79,16 @@ class BIDocument(__BIDocumentInterface, Model):
count = django_fields.PositiveIntegerField()
kwargs = JSONField()

class Meta:
indexes = [
Index(
fields=[
"index",
"time",
]
)
]

else:

class BIDocument(__BIDocumentInterface, Document):
Expand All @@ -88,3 +99,4 @@ class BIDocument(__BIDocumentInterface, Document):
category = mongo_fields.StringField(required=True)
count = mongo_fields.IntField(required=True, min_value=0)
kwargs = mongo_fields.DictField(required=False)
meta = {"indexes": ["index", "time"]}
2 changes: 1 addition & 1 deletion certego_saas/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.7.3"
VERSION = "0.7.4"

0 comments on commit 60d2078

Please sign in to comment.