Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index search preference #1595

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ internal object ObservabilityIndex {
private const val NOTEBOOKS_INDEX_NAME = ".opensearch-notebooks"
private const val OBSERVABILITY_MAPPING_FILE_NAME = "observability-mapping.yml"
private const val OBSERVABILITY_SETTINGS_FILE_NAME = "observability-settings.yml"
private const val SEARCH_ACTION_PREFERENCE = "_primary"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


private var mappingsUpdated: Boolean = false
private lateinit var client: Client
Expand Down Expand Up @@ -298,6 +299,7 @@ internal object ObservabilityIndex {
val searchRequest = SearchRequest()
.indices(INDEX_NAME)
.source(sourceBuilder)
.preference(SEARCH_ACTION_PREFERENCE)
val actionFuture = client.search(searchRequest)
val response = actionFuture.actionGet(PluginSettings.operationTimeoutMs)
val result = ObservabilityObjectSearchResult(request.fromIndex.toLong(), response, searchHitParser)
Expand Down