curl --request POST \
--url https://algolia_application_id.algolia.net/1/compositions/my_composition_object_id/run \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-algolia-api-key: ALGOLIA_API_KEY' \
--header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
--data '
{
"params": {
"analytics": true,
"analyticsTags": [],
"aroundLatLng": "40.71,-74.01",
"aroundLatLngViaIP": false,
"aroundRadius": 1,
"aroundPrecision": 10,
"clickAnalytics": false,
"enableABTest": true,
"enablePersonalization": false,
"enableReRanking": true,
"enableRules": true,
"facetFilters": [
[
"category:Book",
"category:-Movie"
],
"author:John Doe"
],
"facets": {
"facetSpecificList": {
"summary": "Specify which facet to retrieve with some marked as disjunctive",
"value": [
"category",
"disjunctive(brand)",
"price"
]
}
},
"filters": "(category:Book OR category:Ebook) AND _tags:published",
"getRankingInfo": false,
"hitsPerPage": 20,
"injectedItems": {
"my-group-key": [
{
"objectID": "my-object-1",
"metadata": {
"my-field": "my-value"
}
},
{
"objectID": "my-object-2"
}
]
},
"insideBoundingBox": "lorem",
"insidePolygon": [
[
47.3165,
4.9665,
47.3424,
5.0201,
47.32,
4.9
],
[
40.9234,
2.1185,
38.643,
1.9916,
39.2587,
2.0104
]
],
"minimumAroundRadius": 1,
"naturalLanguages": [],
"numericFilters": [
[
"inStock = 1",
"deliveryDate < 1441755506"
],
"price < 1000"
],
"optionalFilters": [
"category:Book",
"author:John Doe"
],
"page": 0,
"query": "",
"queryLanguages": [
"es"
],
"relevancyStrictness": 90,
"ruleContexts": [
"mobile"
],
"sortBy": "Price (asc)",
"userToken": "test-user-123"
}
}
'{
"results": [
{
"compositions": {},
"abTestID": 123,
"abTestVariantID": 2,
"aroundLatLng": "40.71,-74.01",
"automaticRadius": "<string>",
"exhaustive": {
"facetsCount": true,
"facetValues": true,
"nbHits": true,
"rulesMatch": true,
"typo": true
},
"appliedRules": [
{}
],
"exhaustiveFacetsCount": true,
"exhaustiveNbHits": true,
"exhaustiveTypo": true,
"facets": {
"category": {
"food": 1,
"tech": 42
}
},
"facets_stats": {},
"index": "indexName",
"indexUsed": "indexNameAlt",
"message": "<string>",
"nbSortedHits": 20,
"parsedQuery": "george clo",
"processingTimeMS": 20,
"processingTimingsMS": {},
"queryAfterRemoval": "<string>",
"redirect": {
"index": [
{
"source": "<string>",
"dest": "<string>",
"reason": "<string>",
"succeed": true,
"data": {
"ruleObjectID": "<string>"
}
}
]
},
"renderingContent": {
"facetOrdering": {
"facets": {
"order": [
"<string>"
]
},
"values": {}
},
"redirect": {
"url": "<string>"
},
"widgets": {
"banners": [
{
"image": {
"urls": [
{
"url": "<string>"
}
],
"title": "<string>"
},
"link": {
"url": "<string>"
}
}
]
}
},
"serverTimeMS": 20,
"serverUsed": "c2-uk-3.algolia.net",
"userData": {
"settingID": "f2a7b51e3503acc6a39b3784ffb84300",
"pluginVersion": "1.6.0"
},
"queryID": "a00dbc80a8d13c4565a442e7e2dca80a",
"_automaticInsights": true,
"hits": [
{
"objectID": "test-record-123",
"_highlightResult": {},
"_snippetResult": {},
"_rankingInfo": {
"firstMatchedWord": 1,
"geoDistance": 1,
"nbExactWords": 1,
"nbTypos": 1,
"userScore": 123,
"filters": 1,
"geoPrecision": 2,
"matchedGeoLocation": {
"lat": 123,
"lng": 123,
"distance": 123
},
"personalization": {
"filtersScore": 123,
"rankingScore": 123,
"score": 123
},
"promoted": true,
"proximityDistance": 1,
"words": 2,
"promotedByReRanking": true,
"composed": {
"my-composition-to-sponsor-products": {
"index": "products",
"injectedItemKey": "sponsored-products"
}
}
},
"_distinctSeqID": 123,
"_extra": {
"_injectedItemKey": "<string>"
}
}
],
"hitsPerPage": 20,
"nbHits": 20,
"nbPages": 1,
"page": 0,
"params": "query=a&hitsPerPage=20",
"query": "shoes",
"feedID": "products-feed"
}
],
"compositions": {
"run": [
{
"objectID": "comp1765458818347",
"appliedRules": [
{
"objectID": "cr-1765458959657"
}
]
}
]
}
}Runs a query on a single composition and returns matching results.
curl --request POST \
--url https://algolia_application_id.algolia.net/1/compositions/my_composition_object_id/run \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-algolia-api-key: ALGOLIA_API_KEY' \
--header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
--data '
{
"params": {
"analytics": true,
"analyticsTags": [],
"aroundLatLng": "40.71,-74.01",
"aroundLatLngViaIP": false,
"aroundRadius": 1,
"aroundPrecision": 10,
"clickAnalytics": false,
"enableABTest": true,
"enablePersonalization": false,
"enableReRanking": true,
"enableRules": true,
"facetFilters": [
[
"category:Book",
"category:-Movie"
],
"author:John Doe"
],
"facets": {
"facetSpecificList": {
"summary": "Specify which facet to retrieve with some marked as disjunctive",
"value": [
"category",
"disjunctive(brand)",
"price"
]
}
},
"filters": "(category:Book OR category:Ebook) AND _tags:published",
"getRankingInfo": false,
"hitsPerPage": 20,
"injectedItems": {
"my-group-key": [
{
"objectID": "my-object-1",
"metadata": {
"my-field": "my-value"
}
},
{
"objectID": "my-object-2"
}
]
},
"insideBoundingBox": "lorem",
"insidePolygon": [
[
47.3165,
4.9665,
47.3424,
5.0201,
47.32,
4.9
],
[
40.9234,
2.1185,
38.643,
1.9916,
39.2587,
2.0104
]
],
"minimumAroundRadius": 1,
"naturalLanguages": [],
"numericFilters": [
[
"inStock = 1",
"deliveryDate < 1441755506"
],
"price < 1000"
],
"optionalFilters": [
"category:Book",
"author:John Doe"
],
"page": 0,
"query": "",
"queryLanguages": [
"es"
],
"relevancyStrictness": 90,
"ruleContexts": [
"mobile"
],
"sortBy": "Price (asc)",
"userToken": "test-user-123"
}
}
'{
"results": [
{
"compositions": {},
"abTestID": 123,
"abTestVariantID": 2,
"aroundLatLng": "40.71,-74.01",
"automaticRadius": "<string>",
"exhaustive": {
"facetsCount": true,
"facetValues": true,
"nbHits": true,
"rulesMatch": true,
"typo": true
},
"appliedRules": [
{}
],
"exhaustiveFacetsCount": true,
"exhaustiveNbHits": true,
"exhaustiveTypo": true,
"facets": {
"category": {
"food": 1,
"tech": 42
}
},
"facets_stats": {},
"index": "indexName",
"indexUsed": "indexNameAlt",
"message": "<string>",
"nbSortedHits": 20,
"parsedQuery": "george clo",
"processingTimeMS": 20,
"processingTimingsMS": {},
"queryAfterRemoval": "<string>",
"redirect": {
"index": [
{
"source": "<string>",
"dest": "<string>",
"reason": "<string>",
"succeed": true,
"data": {
"ruleObjectID": "<string>"
}
}
]
},
"renderingContent": {
"facetOrdering": {
"facets": {
"order": [
"<string>"
]
},
"values": {}
},
"redirect": {
"url": "<string>"
},
"widgets": {
"banners": [
{
"image": {
"urls": [
{
"url": "<string>"
}
],
"title": "<string>"
},
"link": {
"url": "<string>"
}
}
]
}
},
"serverTimeMS": 20,
"serverUsed": "c2-uk-3.algolia.net",
"userData": {
"settingID": "f2a7b51e3503acc6a39b3784ffb84300",
"pluginVersion": "1.6.0"
},
"queryID": "a00dbc80a8d13c4565a442e7e2dca80a",
"_automaticInsights": true,
"hits": [
{
"objectID": "test-record-123",
"_highlightResult": {},
"_snippetResult": {},
"_rankingInfo": {
"firstMatchedWord": 1,
"geoDistance": 1,
"nbExactWords": 1,
"nbTypos": 1,
"userScore": 123,
"filters": 1,
"geoPrecision": 2,
"matchedGeoLocation": {
"lat": 123,
"lng": 123,
"distance": 123
},
"personalization": {
"filtersScore": 123,
"rankingScore": 123,
"score": 123
},
"promoted": true,
"proximityDistance": 1,
"words": 2,
"promotedByReRanking": true,
"composed": {
"my-composition-to-sponsor-products": {
"index": "products",
"injectedItemKey": "sponsored-products"
}
}
},
"_distinctSeqID": 123,
"_extra": {
"_injectedItemKey": "<string>"
}
}
],
"hitsPerPage": 20,
"nbHits": 20,
"nbPages": 1,
"page": 0,
"params": "query=a&hitsPerPage=20",
"query": "shoes",
"feedID": "products-feed"
}
],
"compositions": {
"run": [
{
"objectID": "comp1765458818347",
"appliedRules": [
{
"objectID": "cr-1765458959657"
}
]
}
]
}
}searchYour Algolia application ID.
Your Algolia API key with the necessary permissions to make the request. Permissions are controlled through access control lists (ACL) and access restrictions. The required ACL to make a request is listed in each endpoint's reference.
Unique Composition ObjectID. Composition unique identifier.
"my_composition_object_id"
Show child attributes
Was this page helpful?