To use OpenSearch's algorithm features in search requests, pass the required custom parameters through the SDK for Java. This page lists the parameters for each algorithm module and shows how to set them in your code.
All code examples are pseudocode.
Query analysis
Query analysis powers text vectorization and named entity recognition (NER).
| Parameter | Required | Description |
|---|---|---|
raw_query | Yes | The original search query string. Used by the text vectorization and NER models. |

...
// Create a SearchParams object.
SearchParams searchParams = new SearchParams(config);
searchParams.setQuery("default:'OpenSearch'");
// Set the raw_query parameter.
Map<String, String> customParam = new HashMap<>();
customParam.put("raw_query", "OpenSearch");
searchParams.setCustomParam(customParam);
// Run the query and return the results as a SearchResult object.
SearchResult execute = searcherClient.execute(searchParams);
...