Skip to main content
POST
/
1
/
compositions
/
{compositionID}
/
facets
/
{facetName}
/
query
curl
curl --request POST \
  --url https://algolia_application_id.algolia.net/1/compositions/my_composition_object_id/facets/lorem/query \
  --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":{"query":"","maxFacetHits":10,"searchQuery":{"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"]]},"facetAll":{"summary":"Retrieve all facets","value":[["*"]]}},"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": [
    {
      "indexName": "<string>",
      "facetHits": [
        {
          "value": "Mobile phone",
          "highlighted": "<em>George</em> <em>Clo</em>oney",
          "count": 123
        }
      ],
      "exhaustiveFacetsCount": true,
      "processingTimeMS": 20
    }
  ]
}
Required ACL: search

Authorizations

x-algolia-application-id
string
header
required

Your Algolia application ID.

x-algolia-api-key
string
header
required

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.

Path Parameters

compositionID
string
required

Unique Composition ObjectID. Composition unique identifier.

Example:

"my_composition_object_id"

facetName
string
required

Facet attribute in which to search for values.

This attribute must be included in the attributesForFaceting index setting with the searchable() modifier.

Body

application/json
params
searchForFacetValuesParams · object

Response

OK

results
object[]

Search for facet values results.