Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.7.4 #59

Merged
merged 4 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"