SearcherClient
Sends query requests to OpenSearch. SearcherClient is thread-safe and can be shared across threads.
Constructor
SearcherClient(ServiceClient serviceclient)Pass a ServiceClient instance to initialize SearcherClient.
| Parameter | Type | Description |
|---|---|---|
serviceclient | ServiceClient | The client that handles communication with OpenSearch. |
Thread safety
| Object | Thread-safe | Notes |
|---|---|---|
SearcherClient | Yes | Share a single instance across threads. |
Methods
execute(SearchParams)
SearchResult execute(SearchParams searchParams)Runs a query defined by a SearchParams object and returns the results in a SearchResult object.
| Parameter | Type | Description |
|---|---|---|
searchParams | SearchParams | The query to run. |
Use this method when you have a fully constructed SearchParams object to pass directly.
execute(SearchParamsBuilder)
SearchResult execute(SearchParamsBuilder paramsBuilder)Runs a query defined by a SearchParamsBuilder object and returns the results in a SearchResult object.
| Parameter | Type | Description |
|---|---|---|
paramsBuilder | SearchParamsBuilder | The builder that constructs and defines the query to run. |
Use this method to construct query parameters fluently using the builder pattern.
executeDebug(SearchParams)
SearchResultDebug executeDebug(SearchParams searchParams)Runs a query defined by a SearchParams object and returns a SearchResultDebug object. Unlike execute, SearchResultDebug also exposes the raw request string of the last query or push, which is useful for inspecting how the request was constructed.
| Parameter | Type | Description |
|---|---|---|
searchParams | SearchParams | The query to run. |
Use executeDebug instead of execute when you need to inspect or log the exact request string sent to OpenSearch — for example, when troubleshooting unexpected query results.