opensearch-project / opensearch-project/opensearch-java
[FEATURE] Boost functionality support for MultiMatchQuery
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 165
- Forks
- 250
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 26
Description
We are porting from ES 6.X to OS 2.X. In the old org.elasticsearch.index.query.MultiMatchQueryBuilder there is a field method which accepts field name and the boost value. So each field can be boosted as desired. But with the new org.opensearch.client.opensearch._types.query_dsl.MultiMatchQuery.Builder we don't have a method like this. So we can't set boost values.
I believe having same old field method is required to set the boost values for each field. See below the old method code
if (Strings.isEmpty(field)) {
throw new IllegalArgumentException("supplied field is null or empty.");
} else {
this.fieldsBoosts.put(field, boost);
return this;
}
}
Although I didn't see any documentation about it but I suspect setting boost values on a field can be achieved via updating the field name. So boost a field named "title" we can add field like this. Even we have this feature should we also have a method for field boost? I think we should.
multiMatchQueryBuilder.fields("title^10")
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the org.opensearch.client.opensearch._types.query_dsl.MultiMatchQuery.Builder and compare its field handling with the old org.elasticsearch MultiMatchQueryBuilder.field(String, float) method shown here. Check whether fields("title^10") already provides equivalent behavior; done means the supported approach for per-field boost values is clear and, if needed, the builder exposes the requested capability.
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
- 35/100