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

[Feature Request] SearchExtBuilder in SearchResponse #9328

Closed
austintlee opened this issue Aug 15, 2023 · 7 comments
Closed

[Feature Request] SearchExtBuilder in SearchResponse #9328

austintlee opened this issue Aug 15, 2023 · 7 comments
Assignees
Labels
enhancement Enhancement or improvement to existing feature or request Search Search query, autocomplete ...etc v2.10.0

Comments

@austintlee
Copy link
Contributor

austintlee commented Aug 15, 2023

Is your feature request related to a problem? Please describe.
In conversational search where the result of Retrieval Augmented Generation (RAG) is a single "hit" (answer), I would like a way to include this answer in the search response separately from the search hits.

Describe the solution you'd like
As RAG is accomplished via a search pipeline, I would like a solution that makes it easy for users to match a part of the response with the search pipeline that generated the part. SearchRequest already provides this through SearchExtBuilders. Adding support for SearchExtBuilders to SearchResponse will probably solve a number of use cases.

Describe alternatives you've considered
For conversational search specifically, a generated answer could be returned as an additional search hit, but this feels hacky and won't generalize to solve other, similar problems that require something in the search response that does not alter SearchHits.

Additional context
#6794 also proposes a way to include extra information in SearchResponse.

Sample

{
  "took": 3,
  "timed_out": false,
  "_shards": {
    "total": 3,
    "successful": 3,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 110,
      "relation": "eq"
    },
    "max_score": 0.55129033,
    "hits": [
      {
       "_index": "...",
        "_id": "...",
        "_score": 0.55129033,
        "_source": {
          "text": "...",
          "title": "..."
        }
      },
      {
      ...
      }
      ...
      {
      ...
      }
    ],
  }, // end of hits
  "ext": {
    "generative_qa": { // a search response processor
      "answer": "..."
    }
  }
} 
@austintlee austintlee added enhancement Enhancement or improvement to existing feature or request untriaged labels Aug 15, 2023
@Xtansia Xtansia added the Search Search query, autocomplete ...etc label Aug 15, 2023
austintlee added a commit to austintlee/OpenSearch that referenced this issue Aug 16, 2023
@austintlee
Copy link
Contributor Author

@msfroh Tagging you to get feedback on this change. Is this generally in the right direction? Thanks in advance.

@austintlee
Copy link
Contributor Author

Can we assign this one to me and remove the 'untriaged' label?

@navneet1v
Copy link
Contributor

@austintlee can you please add a sample response on where this new key will be added in Search Response.

@austintlee
Copy link
Contributor Author

#9379 (comment)

Note that I fixed the indenting issue in the sample. @navneet1v

@navneet1v
Copy link
Contributor

@austintlee lets add the sample here too. So that we understand what is scope of this issue.

@austintlee
Copy link
Contributor Author

@austintlee lets add the sample here too. So that we understand what is scope of this issue.

Sample added to the description above. Thanks!

austintlee added a commit to austintlee/OpenSearch that referenced this issue Aug 25, 2023
reta pushed a commit that referenced this issue Aug 29, 2023
* Add SearchExtBuilders to SearchResponse. [Issue #9328](#9328)

Signed-off-by: Austin Lee <austin@aryn.ai>

* Keep SearchResponse immutable, add a constructor to take a List of SearchExtBuilders.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Fix spotlessJavaCheck findings.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Move SearchExtBuilders into SearchResponseSections, fix indenting in SearchRequest.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Updated changelog (mixed minor formatting issues), added version checks on serialization/deserialization, added a Builder for making copies of SearchResponse easier.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add GenericSearchExtBuilder as a catch-all for SearchExtBuilders not registered in xcontent registry.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Simplify GenericSearchExtBuilder using a single Object member.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Address additional review comments.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add Javadocs.

Signed-off-by: Austin Lee <austin@aryn.ai>

---------

Signed-off-by: Austin Lee <austin@aryn.ai>
austintlee added a commit to austintlee/OpenSearch that referenced this issue Aug 29, 2023
* Add SearchExtBuilders to SearchResponse. [Issue opensearch-project#9328](opensearch-project#9328)

Signed-off-by: Austin Lee <austin@aryn.ai>

* Keep SearchResponse immutable, add a constructor to take a List of SearchExtBuilders.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Fix spotlessJavaCheck findings.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Move SearchExtBuilders into SearchResponseSections, fix indenting in SearchRequest.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Updated changelog (mixed minor formatting issues), added version checks on serialization/deserialization, added a Builder for making copies of SearchResponse easier.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add GenericSearchExtBuilder as a catch-all for SearchExtBuilders not registered in xcontent registry.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Simplify GenericSearchExtBuilder using a single Object member.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Address additional review comments.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add Javadocs.

Signed-off-by: Austin Lee <austin@aryn.ai>

---------

Signed-off-by: Austin Lee <austin@aryn.ai>
(cherry picked from commit 60787b8)
reta added a commit that referenced this issue Aug 30, 2023
* Add SearchExtBuilders to SearchResponse.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add SearchExtBuilders to SearchResponse (#9379)

* Add SearchExtBuilders to SearchResponse. [Issue #9328](#9328)

Signed-off-by: Austin Lee <austin@aryn.ai>

* Keep SearchResponse immutable, add a constructor to take a List of SearchExtBuilders.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Fix spotlessJavaCheck findings.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Move SearchExtBuilders into SearchResponseSections, fix indenting in SearchRequest.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Updated changelog (mixed minor formatting issues), added version checks on serialization/deserialization, added a Builder for making copies of SearchResponse easier.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add GenericSearchExtBuilder as a catch-all for SearchExtBuilders not registered in xcontent registry.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Simplify GenericSearchExtBuilder using a single Object member.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Address additional review comments.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add Javadocs.

Signed-off-by: Austin Lee <austin@aryn.ai>

---------

Signed-off-by: Austin Lee <austin@aryn.ai>
(cherry picked from commit 60787b8)

* Update SearchExtBuilder support version check to work on 2.x line.

Signed-off-by: Austin Lee <austin@aryn.ai>

---------

Signed-off-by: Austin Lee <austin@aryn.ai>
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Co-authored-by: Andriy Redko <andriy.redko@aiven.io>
@sejli
Copy link
Member

sejli commented Aug 31, 2023

PRs merged into main and 2.x, thanks for the contribution @austintlee! 🎉

@sejli sejli closed this as completed Aug 31, 2023
kaushalmahi12 pushed a commit to kaushalmahi12/OpenSearch that referenced this issue Sep 12, 2023
* Add SearchExtBuilders to SearchResponse. [Issue opensearch-project#9328](opensearch-project#9328)

Signed-off-by: Austin Lee <austin@aryn.ai>

* Keep SearchResponse immutable, add a constructor to take a List of SearchExtBuilders.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Fix spotlessJavaCheck findings.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Move SearchExtBuilders into SearchResponseSections, fix indenting in SearchRequest.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Updated changelog (mixed minor formatting issues), added version checks on serialization/deserialization, added a Builder for making copies of SearchResponse easier.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add GenericSearchExtBuilder as a catch-all for SearchExtBuilders not registered in xcontent registry.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Simplify GenericSearchExtBuilder using a single Object member.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Address additional review comments.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add Javadocs.

Signed-off-by: Austin Lee <austin@aryn.ai>

---------

Signed-off-by: Austin Lee <austin@aryn.ai>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
brusic pushed a commit to brusic/OpenSearch that referenced this issue Sep 25, 2023
* Add SearchExtBuilders to SearchResponse. [Issue opensearch-project#9328](opensearch-project#9328)

Signed-off-by: Austin Lee <austin@aryn.ai>

* Keep SearchResponse immutable, add a constructor to take a List of SearchExtBuilders.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Fix spotlessJavaCheck findings.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Move SearchExtBuilders into SearchResponseSections, fix indenting in SearchRequest.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Updated changelog (mixed minor formatting issues), added version checks on serialization/deserialization, added a Builder for making copies of SearchResponse easier.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add GenericSearchExtBuilder as a catch-all for SearchExtBuilders not registered in xcontent registry.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Simplify GenericSearchExtBuilder using a single Object member.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Address additional review comments.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add Javadocs.

Signed-off-by: Austin Lee <austin@aryn.ai>

---------

Signed-off-by: Austin Lee <austin@aryn.ai>
Signed-off-by: Ivan Brusic <ivan.brusic@flocksafety.com>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this issue Apr 25, 2024
* Add SearchExtBuilders to SearchResponse. [Issue opensearch-project#9328](opensearch-project#9328)

Signed-off-by: Austin Lee <austin@aryn.ai>

* Keep SearchResponse immutable, add a constructor to take a List of SearchExtBuilders.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Fix spotlessJavaCheck findings.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Move SearchExtBuilders into SearchResponseSections, fix indenting in SearchRequest.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Updated changelog (mixed minor formatting issues), added version checks on serialization/deserialization, added a Builder for making copies of SearchResponse easier.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add GenericSearchExtBuilder as a catch-all for SearchExtBuilders not registered in xcontent registry.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Simplify GenericSearchExtBuilder using a single Object member.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Address additional review comments.

Signed-off-by: Austin Lee <austin@aryn.ai>

* Add Javadocs.

Signed-off-by: Austin Lee <austin@aryn.ai>

---------

Signed-off-by: Austin Lee <austin@aryn.ai>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Search Search query, autocomplete ...etc v2.10.0
Projects
Status: 2.10.0 (Launched)
Status: Done
Development

No branches or pull requests

6 participants