Api-admin catalog creation query

I try to create a catalog for the API access approved users from the /api-admin/catalogs/2/ page. In the field “query”, I enter the “query_string” type query of ElasticSearch key:CBS and it returns courses, but if I use other fields in the query they do not return courses. For example reporting_type:mooc does not return a course.

I checked the discovery /api/v1/courses/EDU+edu_biology_ar/ endpoint, to get data and fields names of the course that I think I was able to use during the creation of the ElasticSearch query during catalog creation.

I want to discuss:

  • What fields I can use for query_string ElasticSearch query during the /api-admin/catalogs/2/ catalog creation?
  • How can I create the nested “query_string” type query? For example, I want to get all courses of specific owner owners.key:EDU. This nested query does not work for me, why?
  • After the catalog was created and it has courses in preview, why does the user (Client ID & Client Secret → Token) don’t see the catalogs courses using discovery /api/v1/catalogs/2/courses endpoint? The “results” field is empty.

Sorry @Vladimir_Susloparov , I don’t have course discovery running in my devstack at the moment, and don’t have any client sites running it either right now, so I can’t help much here.

The Course Discovery service is pretty awkward to use directly, which is part of the reason why the Publisher Frontend app was created. You may get better results using that.

  • What fields I can use for query_string ElasticSearch query during the /api-admin/catalogs/2/ catalog creation?

You can preview the results of a various queries, by logging into to Course Discovery and visiting the home page – it shows a query form and some example queries.

Also note – to ensure that the data in Course Discovery is indexed by Elasticsearch, you need to run some scripts regularly (e.g. using crontab). See Quickstart — edX Discovery Service 0.1 documentation

  • How can I create the nested “query_string” type query? For example, I want to get all courses of specific owner owners.key:EDU. This nested query does not work for me, why?

My guess would be that there’s strict filtering done on the provided query string which doesn’t support nested queries. Fixing this would require a change request to be made to Course Discovery.

I’m not sure what your use case is, but you might also be able to get what you need by querying elasticsearch directly, which would give you the full range of Elasticsearch DSL options: Advanced Usage — edX Discovery Service 0.1 documentation

  • After the catalog was created and it has courses in preview, why does the user (Client ID & Client Secret → Token) don’t see the catalogs courses using discovery /api/v1/catalogs/2/courses endpoint? The “results” field is empty.

Is your instance is running the refresh_course_metadata management command regularly? See Quickstart — edX Discovery Service 0.1 documentation