Using the JavaScript driver to run an elasticsearch query
The Cloud CMS REST API allows for elasticsearch queries against a branch. The API endpoint is
POST /repositories/{repositoryId}/branches/{branchId}/nodes/search
The payload is a JSON object containing a top-level property called "search" which wraps the elasticsearch DSL query.
The JavaScript driver exposes this call on the Branch object using the searchNodes() methods.
Examples:
1) Search for nodes containing the keyword "hello" in any property:
2) The same search but limit the properties searched to the "body" and "title" properties:
3) The same property limited search but using a different form of search:
4) The same property limited search but further filter the results to nodes of type demo:hero. Note the double underscore in the "__type" property name. See this page for an explanation:
Didn’t find what you need? Customers can open a ticket (opens the support portal in a new tab), or browse the documentation.