Skip to content

Conversation

rdettai
Copy link
Collaborator

@rdettai rdettai commented Jul 16, 2025

Description

Closes #3142

I only found a description about how to use sort_by in the internal docs.

How was this PR tested?

Describe how you tested this PR.

| `max_hits` | `Integer` | Maximum number of hits to return (by default 20) | `20` |
| `search_field` | `[String]`\* | Fields to search on if no field name is specified in the query. | index_config.search_settings.default_search_fields |
| `snippet_fields` | `[String]`\* | Fields to extract snippet on. | |
| `sort_by` | `[String]`\* | Fields to sort the query results on. You can sort by one or two fast fields or by BM25 `_score` (requires fieldnorms). By default, fields are sorted in descending order, to sort by ascending order prepend `-` (e.g "-field1"). If no field is specified, hits are sorted in reverse order of their [document ID](/docs/overview/concepts/querying.md#document-id) (to show recent events first). | |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `sort_by` | `[String]`\* | Fields to sort the query results on. You can sort by one or two fast fields or by BM25 `_score` (requires fieldnorms). By default, fields are sorted in descending order, to sort by ascending order prepend `-` (e.g "-field1"). If no field is specified, hits are sorted in reverse order of their [document ID](/docs/overview/concepts/querying.md#document-id) (to show recent events first). | |
| `sort_by` | `String` | Fields to sort the query results on. You can sort by one or two fast fields or by BM25 `_score` (requires fieldnorms). By default, fields are sorted in descending order, to sort by ascending order prepend `-` (e.g "-field1"). If no field is specified, hits are sorted in reverse order of their [document ID](/docs/overview/concepts/querying.md#document-id) (to show recent events first). | |

Based on the API docs and the test data below, this is a string and not an array of strings, where the fields are comma separated.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add sort_by examples in the docs
2 participants