You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user/ppl/interfaces/endpoint.md
+109-1Lines changed: 109 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,115 @@ Expected output:
53
53
}
54
54
```
55
55
56
-
## Explain
56
+
## Highlight
57
+
58
+
### Description
59
+
60
+
You can include an optional `highlight` object in the request body to request search result highlighting. When a PPL query contains a full-text search (e.g., `search source=logs "error"`), OpenSearch identifies where the search terms appear in document fields and returns the matching fragments wrapped in the specified tags.
61
+
62
+
The `highlight` object supports the following parameters:
63
+
64
+
| Parameter | Type | Required | Description |
65
+
|-----------|------|----------|-------------|
66
+
|`fields`| Object | Yes | Map of field names to per-field configuration. Use `"*"` to highlight all `text` and `keyword` fields that match. |
67
+
|`pre_tags`| Array of strings | No | Tags inserted before each highlighted term. Default: `["<em>"]`. |
68
+
|`post_tags`| Array of strings | No | Tags inserted after each highlighted term. Default: `["</em>"]`. |
69
+
|`fragment_size`| Integer | No | Maximum character length of each highlight fragment. Default is OpenSearch's default (100). Set to `2147483647` to return the entire field value without truncation. |
70
+
71
+
### What gets highlighted
72
+
73
+
-**Full-text search terms only.** The search term in `search source=logs "error"` is translated to a `query_string` query, and OpenSearch's highlighter identifies matches. Structured filters (`where`, `stats`, comparison operators) do not produce highlights.
74
+
-**`text` and `keyword` fields only.** Numeric, date, boolean, and other non-string field types never produce highlight fragments.
75
+
-**Wildcard field matching.**`"*": {}` matches all eligible fields, including `.keyword` subfields.
Only the `address` field is highlighted. Rows where "Holmes" appears in other fields have `null` highlight entries.
151
+
152
+
### Response format
153
+
154
+
- The `highlights` array is parallel to `datarows` — each entry corresponds to the row at the same index.
155
+
- Entries are `null` when a row has no highlight data for the requested fields.
156
+
- The `highlights` array is **omitted entirely** when no `highlight` config is provided in the request (backward compatible).
157
+
158
+
### Notes
159
+
160
+
- Highlighting is supported only in the Calcite engine.
161
+
- The backend forwards the highlight config as-is to OpenSearch. The same highlighting behavior and limitations as [OpenSearch's highlighting API](https://opensearch.org/docs/latest/search-plugins/searching-data/highlight/) apply.
162
+
- Piped commands (`where`, `sort`, `head`, `dedup`) narrow or reorder the result set but do not affect which terms are highlighted.
0 commit comments