opensearch-project / opensearch-php

Official PHP Client for OpenSearch
Other
110 stars 58 forks source link

[FEATURE] Implement indices_boost for Multi-index-search #153

Open bastimm opened 1 year ago

bastimm commented 1 year ago

Is your feature request related to a problem?

Yes, I need to search in multiple indices and want to boost one of them

What solution would you like?

Please implement this switch

What alternatives have you considered?

-

Do you have any additional context?

https://opensearch.org/docs/latest/api-reference/search/ => indices_boost

shyim commented 1 year ago

Only the url parameters are restricted, do you have an example where this is not working?

bastimm commented 1 year ago

Hi,

a short excerpt of my PHP code, perhaps I made a mistake?

$this->ESQuery1 = [ 'index' => [ $this->config->getIndexName($this->language), ], 'from' => $this->paginationStart, 'size' => (int) $this->size, ]; if(true){ $this->ESQuery1['index'][] = $this->config->getIndexName($this->language).'_cmsnews'; } $this->ESQuery1['ignore_unavailable'] = true; $this->ESQuery1["indices_boost"] = [ $this->config->getIndexName($this->language) => 3, $this->config->getIndexName($this->language).'_cmsnews' => 2 ] ;

If I add "indices_boost" I got this result: [message:protected] => "indices_boost" is not a valid parameter. Allowed parameters are "_source", "_source_excludes", "_source_includes", "allow_no_indices"

Thanks in advance!!!

shyim commented 1 year ago

indices_boost is part of the request body. So the array would be:

[
  'index' => $myIndex,
  'body' => [
    'indices_boost' => $myBoost
  ]
]

🤔

saimedhi commented 6 months ago

Hello @bastimm,

I hope you're doing well. Could you please confirm if this issue has been resolved?

Thank you.