Open KaganAddSearch opened 1 year ago
@KaganAddSearch Thank you for raising this issue!
As I understand, you are suggesting one of the 2 options:
boost
field support in MultiMatchQueryBuilder - which is a code change on this repo.multiMatchQueryBuilder.fields("title^10")
to boost - have you tried this out?@VachaShah We have tried multiMatchQueryBuilder.fields("title^10")
. It seems to be working. It is a usable solution but this should be documented. So users don't have to guess this.
Thats great @KaganAddSearch! Thank you for getting back on this.
Definitely we should add a test and a working sample in https://github.com/opensearch-project/opensearch-java/tree/main/samples for documentation along with the guides. Would be willing to take this up?
Hi @VachaShah , I would like to work in this issue. Can you please assign it to me?
@pranishd1 Are you still (wanting to) work(ing) on this?
@pranishd1 Are you still (wanting to) work(ing) on this?
@dblock , sorry I am occupied right now.
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
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")