FAQs
This page addresses frequently asked questions about Composite Search API.
Samples of how to use filter operators in composite search API?
Sample 1 - Find all node types that contain specific search term (content, words, assets)
{ "request": { "query":"elephant", "limit":10 } }
Sample 2 - Find only TextBook
{ "request": {"filters":{"primaryCategory":"Digital Textbook"}, "limit":10 } }
Sample 3 - Find "Explanation Content" less than 1MB
{ "request": {"filters":{"primaryCategory":"Explanation Content", "size": {"<=" : "1000000"}}, "limit":10 } }
Sample 4 - Find resources whose 'name' starts with "A" (e.g. for alphabetic navigation)
{ "request": { "filters": { "primaryCategory":"Explanation Content", "name": { "startsWith": "A" } } } }
Sample 5 - Find resources without 'appIcon'
{ "request": { "filters": { "primaryCategory":"Explanation Content" }, "not_exists":["appIcon"] } }
Sample 6 - Find resources with 'appIcon'
{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "exists":["appIcon"] } }
Sample 7 - Find resources and aggregate results by 'language' and 'subject'
{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "facets":["language","subject"] } }
Sample 8 - Find resources and sort results by name ascending and size desc
{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "sort_by":{"name":"asc", "size":"desc"} } }
Sample 9 - Get first 10 results
{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "sort_by":{"name":"asc", "size":"desc"}, "offset": 0, "limit": 10 } }
Sample 10 - Get 4th page of results. Results from 30 - 40 index.
{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "sort_by":{"name":"asc", "size":"desc"}, "offset": 30, "limit": 10 } }
Sample 11 - Get the fields specified.
{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "exists":["appIcon"], "fields":["name","description","identifier","mimeType","createdOn"] } }
Sample 12 - Search for content with soft constraints
{ "request": { "filters": { "objectType": ["Content"], "primaryCategory": ["Explanation Content"], "gradeLevel" : ["Grade 1"], "ageGroup" : ["5-6"], "status": ["Live"] }, "mode" : ["soft"], "softConstraints": {"ageGroup" : 2, "gradeLevel" : 3 } } }
Sample 13 - Find "Explanation Content" created between a time range
{ "request": { "filters": { "primaryCategory":"Explanation Content", "createdOn": {">=":"2020-07-28T01:27:16.559+0000", "<":"2021-10-28T01:27:16.559+0000"} }, "sort_by":{"name":"asc"}, "offset": 0, "limit": 10 } }
Sample 14 - Find published Textbooks to which a content is linked to
{ "request": { "filters": { "primaryCategory":"Digital Textbook", "leafNodes": {"contains": "do_Id___content"} }, "sort_by":{"name":"asc"} } }
What are the different modes that can be passed in search request?
There are 2 modes in search. 'soft' and 'collection' mode. By default, mode is 'soft' in a search request if the same is not specified. When the mode is specified as 'collection', then the search result will contain 'collections' block which will have the metadata of collections of the collection units that is part of the search result
Example:
In the above example 'Response',
"collections" block gives the information of the TextBook that contains the 'TextBookUnit' to which DIAL Code is tagged to. "identifier" - id of the TextBook, "name" - name of the TextBook, "board" - board value to which TextBook is tagged to. similarly, "medium", "gradeLevel" (Class) and "subject" values.
"content" block gives the information of the TextBook Unit DIAL Code is tagged to. "identifier" - id of the TextBook Unit, "name" - name of the TextBook Unit, "topic" - topics/concepts to which Unit is tagged with.
What is 'softConstraints' in search request?
'softConstraints' is used to fetch results from ElasticSearch by boosting the relevance of a document based on a particular value of a field.
Is 'Fuzzy Search' enabled in search API?
No. Fuzzy search has not been implemented in the search API.
Last updated