> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# algolia compositions sorting-strategy

> Set the sorting strategy of a composition.

```txt Usage theme={"system"}
algolia compositions sorting-strategy <composition-id> [flags]
```

## Examples

Set the sorting strategy from a JSON file:

```sh icon=square-terminal theme={"system"}
algolia compositions sorting-strategy my-comp --file strategy.json
```

Set it from stdin:

```sh icon=square-terminal theme={"system"}
echo '{"Price (asc)":"products_price_asc"}' | algolia compositions sorting-strategy my-comp --file -
```

Build the mapping interactively:

```sh icon=square-terminal theme={"system"}
algolia compositions sorting-strategy my-comp --interactive
```

## Flags

<ParamField body="-f, --file">
  JSON file path (use - for stdin)
</ParamField>

<ParamField body="-i, --interactive">
  Build the sorting strategy interactively
</ParamField>

## Output formatting flags

<ParamField body="--allow-missing-template-keys">
  If true, ignore errors in templates due to missing fields or map keys. This only applies to golang and jsonpath output formats.
</ParamField>

<ParamField body="-o, --output">
  Output format. One of: (json, jsonl, ndjson, jsonpath, jsonpath-as-json, jsonpath-file).
</ParamField>

<ParamField body="--template">
  Template string or path to a template file to use when --output=jsonpath, --output=jsonpath-file.
</ParamField>
