Skip to content

Commit 668aee1

Browse files
authored
[ESQL] Add FUSE to inline docs (#237495)
1 parent 99bfd39 commit 668aee1

File tree

2 files changed

+153
-0
lines changed

2 files changed

+153
-0
lines changed

src/platform/packages/private/kbn-language-documentation/scripts/resources/commands/source_data.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,80 @@ FROM employees METADATA _index, _id
7575
},
7676
openLinksInNewTab: true,
7777
},
78+
{
79+
name: 'fuse',
80+
labelDefaultMessage: 'FUSE',
81+
descriptionDefaultMessage: `### FUSE
82+
83+
The \`FUSE\` [processing command](https://www.elastic.co/docs/reference/query-languages/esql/commands/processing-commands) merges rows from multiple result sets and assigns new relevance scores. \`FUSE\` is for search use cases. Learn more about [how search works in ES|QL](https://www.elastic.co/docs/solutions/search/esql-for-search#how-search-works-in-esql).
84+
85+
Together with \`FORK\`, \`FUSE\` enables [hybrid search](https://www.elastic.co/docs/reference/query-languages/esql/esql-search-tutorial#perform-hybrid-search) to combine and score results from multiple queries.
86+
87+
\`FUSE\` works by:
88+
89+
1. Merging rows with matching \`<key_columns>\` values
90+
2. Assigning new relevance scores using the specified \`<fuse_method>\` algorithm and the values from the \`<group_column>\` and \`<score_column>\`
91+
#### Syntax
92+
93+
Use default parameters:
94+
95+
\`\`\` esql
96+
FUSE
97+
\`\`\`
98+
99+
Specify custom parameters:
100+
101+
\`\`\` esql
102+
FUSE <fuse_method> SCORE BY <score_column> GROUP BY <group_column> KEY BY <key_columns> WITH <options>
103+
\`\`\`
104+
105+
#### Parameters
106+
107+
\`fuse_method\`
108+
: Defaults to \`RRF\`. Can be one of \`RRF\` (for [Reciprocal Rank Fusion](https://cormack.uwaterloo.ca/cormacksigir09-rrf.pdf)) or \`LINEAR\` (for linear combination of scores). Designates which method to use to assign new relevance scores.
109+
110+
\`score_column\`
111+
: Defaults to \`_score\`. Designates which column to use to retrieve the relevance scores of the input row and where to output the new relevance scores of the merged rows.
112+
113+
\`group_column\`
114+
: Defaults to \`_fork\`. Designates which column represents the result set.
115+
116+
\`key_columns\`
117+
: Defaults to \`_id, _index\`. Rows with matching values for these columns are merged.
118+
119+
\`options\`
120+
: Options for the \`fuse_method\`.
121+
122+
\`rank_constant\`
123+
: Defaults to \`60\`. Represents the \`rank_constant\` used in the RRF formula.
124+
125+
\`weights\`
126+
: Defaults to \'\{\}\' (empty object). Allows you to set different weights based on \`group_column\` values.
127+
128+
\`normalizer\`
129+
: Defaults to \`none\`. Can be one of \`none\` or \`minmax\`. Specifies which score normalization method to apply.
130+
131+
#### Examples
132+
133+
- Use RRF to merge two ranked result sets.
134+
135+
\`\`\` esql
136+
FROM books METADATA _id, _index, _score
137+
| FORK (WHERE title:"Shakespeare" | SORT _score DESC)
138+
(WHERE semantic_title:"Shakespeare" | SORT _score DESC)
139+
| FUSE
140+
\`\`\`
141+
142+
Refer to the [reference documentation](https://www.elastic.co/docs/reference/query-languages/esql/commands/fuse) for more information, including additional examples and limitations.
143+
`,
144+
descriptionOptions: {
145+
description:
146+
'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',
147+
ignoreTag: true,
148+
},
149+
openLinksInNewTab: true,
150+
preview: true,
151+
},
78152
{
79153
name: 'row',
80154
labelDefaultMessage: 'ROW',

src/platform/packages/private/kbn-language-documentation/src/sections/generated/source_commands.tsx

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,85 @@ FROM employees METADATA _index, _id
8787
/>
8888
),
8989
},
90+
{
91+
label: i18n.translate('languageDocumentation.documentationESQL.fuse', {
92+
defaultMessage: 'FUSE',
93+
}),
94+
preview: true,
95+
description: (
96+
<Markdown
97+
openLinksInNewTab={true}
98+
markdownContent={i18n.translate('languageDocumentation.documentationESQL.fuse.markdown', {
99+
defaultMessage: `### FUSE
100+
101+
The \`FUSE\` [processing command](https://www.elastic.co/docs/reference/query-languages/esql/commands/processing-commands) merges rows from multiple result sets and assigns new relevance scores. \`FUSE\` is for search use cases. Learn more about [how search works in ES|QL](https://www.elastic.co/docs/solutions/search/esql-for-search#how-search-works-in-esql).
102+
103+
Together with \`FORK\`, \`FUSE\` enables [hybrid search](https://www.elastic.co/docs/reference/query-languages/esql/esql-search-tutorial#perform-hybrid-search) to combine and score results from multiple queries.
104+
105+
\`FUSE\` works by:
106+
107+
1. Merging rows with matching \`<key_columns>\` values
108+
2. Assigning new relevance scores using the specified \`<fuse_method>\` algorithm and the values from the \`<group_column>\` and \`<score_column>\`
109+
#### Syntax
110+
111+
Use default parameters:
112+
113+
\`\`\` esql
114+
FUSE
115+
\`\`\`
116+
117+
Specify custom parameters:
118+
119+
\`\`\` esql
120+
FUSE <fuse_method> SCORE BY <score_column> GROUP BY <group_column> KEY BY <key_columns> WITH <options>
121+
\`\`\`
122+
123+
#### Parameters
124+
125+
\`fuse_method\`
126+
: Defaults to \`RRF\`. Can be one of \`RRF\` (for [Reciprocal Rank Fusion](https://cormack.uwaterloo.ca/cormacksigir09-rrf.pdf)) or \`LINEAR\` (for linear combination of scores). Designates which method to use to assign new relevance scores.
127+
128+
\`score_column\`
129+
: Defaults to \`_score\`. Designates which column to use to retrieve the relevance scores of the input row and where to output the new relevance scores of the merged rows.
130+
131+
\`group_column\`
132+
: Defaults to \`_fork\`. Designates which column represents the result set.
133+
134+
\`key_columns\`
135+
: Defaults to \`_id, _index\`. Rows with matching values for these columns are merged.
136+
137+
\`options\`
138+
: Options for the \`fuse_method\`.
139+
140+
\`rank_constant\`
141+
: Defaults to \`60\`. Represents the \`rank_constant\` used in the RRF formula.
142+
143+
\`weights\`
144+
: Defaults to '{}' (empty object). Allows you to set different weights based on \`group_column\` values.
145+
146+
\`normalizer\`
147+
: Defaults to \`none\`. Can be one of \`none\` or \`minmax\`. Specifies which score normalization method to apply.
148+
149+
#### Examples
150+
151+
- Use RRF to merge two ranked result sets.
152+
153+
\`\`\` esql
154+
FROM books METADATA _id, _index, _score
155+
| FORK (WHERE title:"Shakespeare" | SORT _score DESC)
156+
(WHERE semantic_title:"Shakespeare" | SORT _score DESC)
157+
| FUSE
158+
\`\`\`
159+
160+
Refer to the [reference documentation](https://www.elastic.co/docs/reference/query-languages/esql/commands/fuse) for more information, including additional examples and limitations.
161+
`,
162+
description:
163+
'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',
164+
ignoreTag: true,
165+
})}
166+
/>
167+
),
168+
},
90169
{
91170
label: i18n.translate('languageDocumentation.documentationESQL.row', {
92171
defaultMessage: 'ROW',

0 commit comments

Comments
 (0)