/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React from 'react'; import { EuiFlyout, EuiFlyoutBody, EuiFlyoutHeader, EuiText, EuiTitle, EuiCodeBlock, EuiLink, EuiCode, } from '@elastic/eui'; import { useSearchRelevanceContext } from '../../contexts'; const query1 = ` { "query": { "multi_match": { "query": "%SearchText%", "fields": ["speaker", "text_entry"] } } } `; const query2 = ` { "query": { "multi_match": { "query": "%SearchText%", "fields": ["speaker^3", "text_entry"] } } } `; export const Flyout = () => { const { setShowFlyout } = useSearchRelevanceContext(); return ( setShowFlyout(false)} aria-labelledby="flyoutTitle" paddingSize="l" >

Help

Query format

Enter a query in{' '} OpenSearch Query DSL . Use the %SearchText% variable to refer to the text in the search bar. When you enter Search, the queries are sent to the search engine using the GET HTTP method and the _search{' '} endpoint.

Example


1. Enter the search text in the search bar.

2. Select an index for Query 1 and enter a query.

The following example searches the speaker and{' '} text_entry fields of the shakespeare index for the search text:

{query1}

3. Select an index for Query 2 and enter a query.

You can see how boosting a field affects the results. The following query boosts the speaker field:

{query2}

To learn more about boosts, see the{' '} Multi-match Query Documentation .

4. Compare results

Select Search and compare the results in Results 1 and Results 2.

); };