From 57f2d20e75eac98d8c5a9b7bbd982369aeade9fa Mon Sep 17 00:00:00 2001
From: "opensearch-trigger-bot[bot]"
 <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Date: Tue, 4 Oct 2022 11:43:26 -0700
Subject: [PATCH] [MD] Fix view single document issue by updating low-level
 search call param (#2431) (#2483)

* Add datasource param to low-level search call in Discover
* update change log

Signed-off-by: Su <szhongna@amazon.com>
(cherry picked from commit 1f639b07e4240232242816697c683e3c892ff40f)

Co-authored-by: Zhongnan Su <szhongna@amazon.com>
---
 CHANGELOG.md                                                     | 1 +
 .../application/components/doc/use_opensearch_doc_search.ts      | 1 +
 2 files changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 107a97f4b9d6..c9afb4f180e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 * [Vis Builder] Fixes auto bounds for timeseries bar chart visualization ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401))
 * [Vis Builder] Fixes visualization shift when editing agg ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401))
 * [Vis Builder] Renames "Histogram" to "Bar" in vis type picker ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401))
+* [MD] Add data source param to low-level search call in Discover ([#2431](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2431))
 
 ### 🚞 Infrastructure
 
diff --git a/src/plugins/discover/public/application/components/doc/use_opensearch_doc_search.ts b/src/plugins/discover/public/application/components/doc/use_opensearch_doc_search.ts
index 8d1aa123e43d..b5ca9fec1c2f 100644
--- a/src/plugins/discover/public/application/components/doc/use_opensearch_doc_search.ts
+++ b/src/plugins/discover/public/application/components/doc/use_opensearch_doc_search.ts
@@ -82,6 +82,7 @@ export function useOpenSearchDocSearch({
 
         const { rawResponse } = await getServices()
           .data.search.search({
+            dataSourceId: indexPatternEntity.dataSourceRef?.id,
             params: {
               index,
               body: buildSearchBody(id, indexPatternEntity),