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

feat: added sample script for multisearch #657

Merged
merged 10 commits into from
Dec 7, 2023

Conversation

tejeshreddy
Copy link
Contributor

Description

  • Example to clarify issue 634
  • Sample code for msearch under samples/msearch.js
  • Guide for msearch under guides/msearch.md

Issues Resolved

#634

Check List

  • Linter check was successfull - yarn run lint doesn't show any errors
  • Commits are signed per the DCO using --signoff
  • Changelog was updated.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@tejeshreddy tejeshreddy changed the title feat: added sample script for multisearch [Draft] feat: added sample script for multisearch Nov 30, 2023
@tejeshreddy tejeshreddy marked this pull request as draft November 30, 2023 22:05
@tejeshreddy tejeshreddy changed the title [Draft] feat: added sample script for multisearch feat: added sample script for multisearch Nov 30, 2023
Signed-off-by: tejeshreddy <[email protected]>
Signed-off-by: tejeshreddy <[email protected]>
@tejeshreddy tejeshreddy marked this pull request as ready for review November 30, 2023 22:48
guides/msearch.md Outdated Show resolved Hide resolved
guides/msearch.md Outdated Show resolved Hide resolved
guides/msearch.md Outdated Show resolved Hide resolved
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

The CHANGELOG link needs fixing, for the rest I think they are should have's.

CHANGELOG.md Outdated Show resolved Hide resolved
@@ -0,0 +1,63 @@
# Multi-Search (msearch)

OpenSearch's Multi-Search (`msearch`) API is a tool that allows you to execute multiple search operations for documents within an index efficiently. This API supports various parameters that provide flexibility in customizing your search operations. It's crucial to understand the key differences between `msearch` and a regular `search` operation in OpenSearch. Unlike a single search operation, `msearch` enables you to perform multiple searches in a single API call, significantly reducing network overhead as it need not initialize a new network connection for each search. This proves particularly advantageous for batch operations or scenarios where searches span multiple indices. By combining searches into one request, `msearch` streamlines the process and enhances overall efficiency. Explore the functionalities of the msearch API with the provided sample code in [../samples/msearch.js](../samples/msearch.js).
Copy link
Member

Choose a reason for hiding this comment

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

"is a tool that allows you to" -> "allows you to", it's an API, not a tool :)

I'd be curious to hear what the downsides of msearch are. For example, does msearch require the caller to examine errors themselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd be curious to hear what the downsides of msearch are. For example, does msearch require the caller to examine errors themselves?

@dblock did you mean to say this could be one of the disadvantages? I will include a couple of cons related to msearch in comparison to search

Copy link
Member

Choose a reason for hiding this comment

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

Yep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a con I came across when reading about the difference in both.

does msearch require the caller to examine errors themselves?

For the above point, I wasn't able to find anything substantial. It would be great if you could link doc/resources so I can add it to the guide.

guides/msearch.md Outdated Show resolved Hide resolved
Comment on lines 56 to 57
);
```
Copy link
Member

Choose a reason for hiding this comment

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

It's not clear to me what happens in case of errors? Does the user have to handle that, and if so how? I think the sample should explicitly call it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a try-catch block in the code snippet. Please let me know if there is anything else you're referring to here.

Signed-off-by: tejeshreddy <[email protected]>
Signed-off-by: tejeshreddy <[email protected]>
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Looks good. Link the guide from USER_GUIDE?

@dblock dblock merged commit 9d3524b into opensearch-project:main Dec 7, 2023
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants