-
Notifications
You must be signed in to change notification settings - Fork 2
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
Use Opensearch for learning resource API results whenever feasible #189
Comments
I would lean toward option 1 just for simplicity's sake. Also Option 1 is a subset of Option 2 and I agree that Option 3 is a bad idea for the reasons you describe. So we can start on implementing Option 1 |
I suggest we continue to do what we are doing and revisit this issue later on if needed. |
If we do hold off on using Elasticsearch for the "catalog listing" APIs ( |
@ChristopherChudzicki I'm suggesting we leave both endpoints in place as they are and deal with inconsistencies in filters etc.
Why they accept different values ? |
Description/Context
Use opensearch for API results for lists when feasible (ie not for lists of learning paths requested by editors, perhaps other exceptions) and perhaps single object results as well.
Plan/Design
Option 1: OpenSearch endpoint for lists, database endpoints for individual objects and learning path CRUD
Continue using the database to return:
/api/v1/learning_resources/<pk>/
,/api/v1/courses/<pk>/
, etc)/api/v1/learning_resources/<pk>/children/
). Example: episodes in a podcast, resources in a learning pathProvide a new database-backed API endpoint -
/api/v1/learning_path_admin/
- specifically for learning paths CRUD. This will return specific path details as well as lists of learning paths, both published and unpublished. Only users with editing permission will be allowed to access it.Use opensearch for all read-only learning resource list endpoints (published only):
/api/v1/learning_resources/
,/api/v1/courses/
,/api/v1/programs/
, etc/api/v1/learning_resources/new/
(need to addcreated_on
values to the index and sort by that)api/v1/learning_resources/upcoming/
(need to build an opensearch query filtering byruns.published
and (runs.start_date
orruns.enrollment_start
) then ordering byruns.start_date
)Separate views will be used for each:
learning_resources.views.LearningResourceViewSet(RetrieveModelMixin, viewsets.GenericViewSet)
for individual objects and their childrenlearning_resources.views.LearningPathAdminViewSet(viewsets.ModelViewSet)
for learning path CRUDlearning_resources_search.views.LearningResourcesSearchView(ESView)
for lists of learning resources.URL's would have to be loaded in the following order in
open_discussions/urls.py
:Option 2: OpenSearch endpoint for lists and individual results, database for learning path editing only.
Similar to above, but use opensearch for individual object results and child resources of individual results
parents
field indicating the relation (and type of relation) to other resources. For example,/api/v1/podcasts/<id>/episodes
could not rely on database relationships to get correct results, would need to query opensearch whereparent_id=<id>
andrelation_type=podcast
,Separate views will be used for each:
learning_resources.views.LearningPathViewSet(viewsets.ModelViewSet)
for learning path CRUDlearning_resources_search.views.LearningResourcesSearchView(ESView)
for learning resources lists and individual objectsOption 3: Conditionally switch to an opensearch API view from a database API view, depending on parameters.
This does not seem like the best approach, for several reasons:
It mixes views from two different apps, which does not seem like good practice
Need to ensure that the different views always accept the same query parameters and apply filters consistently.
The views may have slightly different outputs. For example, the current search endpoint does not include
next
andprevious
page attributes, though maybe it should. And the current database-backed endpoint never includes this data structure:Though again, the outputs could probably be made consistent, up to a point (if using database, can't get actual values for those metadata fields, other than empty ones like above).
The text was updated successfully, but these errors were encountered: