Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[MD] Improved error handling for the search API when a null value is passed for the dataSourceId. #5882
[MD] Improved error handling for the search API when a null value is passed for the dataSourceId. #5882
Changes from 6 commits
726c99e
679ec77
77ad0d4
54e81b1
8453c8d
bbe549b
cbf1fec
5fa85f4
456ee13
4075f1e
21ad2d8
7f2616c
657d954
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we assume when data source is enabled, then context.dataSource is never undefined or vice versa?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 @xinruiba Do you have scenario where withDataSourceEnabled is true but context.dataSource is undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comments~
Yes, we can assume when data source is enabled, then context.dataSource is never undefined or vice versa because:
context.dataSource
will never be undefined.In that case,
withDataSourceEnabled
is not needed in this decide client function. I will remove it.Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that you are testing send request without
dataSourceid
, but passdataSourceId: 'Some dataSourceId'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test cases updated, thanks for the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you correct this according to test description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case updated here:
https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5882/files#diff-96950b20277c55c90d7592913fcc77ed6bac02a71701c784f2ac3b03c31d25d6R203
Thanks~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are passing host empty. Can you correct test case description? Also do we have test case when host is not defined, means it is commented? In that case it should take default value and call opensearch client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both updated in the test case:
https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5882/files#diff-96950b20277c55c90d7592913fcc77ed6bac02a71701c784f2ac3b03c31d25d6R242
Thanks for the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to pass empty? What if we don't pass at all? Can we cover both case pass empty or undefined value and doesn't pass at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case updated and handled here:
https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5882/files#diff-96950b20277c55c90d7592913fcc77ed6bac02a71701c784f2ac3b03c31d25d6R237
Thanks
Check warning on line 78 in src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts
src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts#L78
Check warning on line 81 in src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts
src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts#L81
Check warning on line 84 in src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts
src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts#L84