This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
search: minor fixes on elastic search implementation
- Loading branch information
Showing
21 changed files
with
397 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.11 | ||
3.11.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
#from django_elasticsearch_dsl_drf.pagination import QueryFriendlyPageNumberPagination | ||
from rest_framework.pagination import PageNumberPagination | ||
|
||
|
||
class StandardResultsSetPagination(PageNumberPagination): | ||
page_size = 10 | ||
page_size_query_param = "page_size" | ||
max_page_size = 100 | ||
|
||
|
||
class OSStandardResultsSetPagination(PageNumberPagination): | ||
page_size = 10 | ||
page_size_query_param = "page_size" | ||
max_page_size = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from django.conf import settings | ||
from django_opensearch_dsl import Document, fields | ||
from django_opensearch_dsl.registries import registry | ||
|
||
from backoffice.workflows.models import Workflow | ||
|
||
|
||
@registry.register_document | ||
class WorkflowDocument(Document): | ||
id = fields.TextField() | ||
workflow_type = fields.KeywordField() | ||
data = fields.ObjectField() | ||
status = fields.KeywordField() | ||
is_update = fields.BooleanField() | ||
|
||
class Index: | ||
name = settings.OPENSEARCH_INDEX_NAMES[__name__] | ||
settings = { | ||
"number_of_shards": 1, | ||
"number_of_replicas": 1, | ||
"max_result_window": 70000, | ||
} | ||
|
||
class Django: | ||
model = Workflow | ||
fields = [ | ||
"_created_at", | ||
"_updated_at", | ||
] |
24 changes: 24 additions & 0 deletions
24
backoffice/workflows/migrations/0006_workflow__created_at_workflow__updated_at.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 4.2.6 on 2024-06-03 06:25 | ||
|
||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("workflows", "0005_workflowticket_ticket_type_alter_workflow_status"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="workflow", | ||
name="_created_at", | ||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="workflow", | ||
name="_updated_at", | ||
field=models.DateTimeField(auto_now=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FROM opensearchproject/opensearch:2.14.0 | ||
RUN bin/opensearch-plugin install analysis-icu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.conf import settings | ||
from rest_framework.routers import DefaultRouter, SimpleRouter | ||
|
||
from backoffice.workflows.api.views import WorkflowDocumentView | ||
|
||
if settings.DEBUG: | ||
router = DefaultRouter() | ||
else: | ||
router = SimpleRouter() | ||
|
||
|
||
# Workflow | ||
router.register("workflow", WorkflowDocumentView, basename="workflow") | ||
|
||
app_name = "search" | ||
urlpatterns = router.urls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.