opensearch-project / opensearch-project/opensearch-java

[FEATURE] Hybrid query filter support in java client

Open
#1,785 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
165
Forks
250
Avg merge
1d 18h
Merged PRs (30d)
26

Description

I am trying to use the java client to create and execute a Hybrid query with a filter. This is currently supported as documented in the official release notes.

  • Issue n.1: The java client currently comes with a specific class HybridQuery but the builder does not come with a method that lets us set a filter.

To make up for the missing method, I created the query as usual, then I obtained (with the specific method) the raw json that I had to manually modify to set the filter. Then comes another huge problem:

  • Issue n.1: There is no way of executing a generic search request from a manually built json.

The java client does only permit the execution of generic requests with the method “generic().execute(genericRequest)”. This however returns a generic response object so I cannot use many of the SearchResponse methods. Also, this way I cannot specify the class the found documents should be returned as (I am reffering to the usual bi-parameter method search(searchRequest, documentClass) that i cannot use because I am forced make a generic request).

I treat this as a secondary big issue because, even after the Issue n.1 will be resolved, there could be moments in which the java client does not cover all the functionalities implemented in the latest releases. While waiting for the updates, having a generic search request that one can use, would make the users’ requests less urgent by providing a temporary fix for similar problems in the future.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Java client's HybridQuery builder and the generic().execute(genericRequest) entry point described in the issue. Determine how a filter can be supplied to HybridQuery and how a generic search can preserve typed documents and SearchResponse methods; done means both requested usage paths are available.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.