Open Dgame opened 1 year ago
Hey,
I am not sure if this is an SDK problem. For me it sounds like a general OpenSearch issue than an SDK here. Is that right?
No, I guess the problem is that the sort parameter (like everything else except the body) is send in the query. If sort is present, it should be sent in the body too.
Ahh okay, can you show a small example in PHP how you do it?
I'm using the client with an array like in your tests. 🙂
$client = OpenSearch\ClientBuilder::create()->setHosts(["localhost:1"])->setRetries(0)->build();
$searchParams = [
'index' => 'test',
"sort" =>"rating:desc,price:asc",
'body' => [
'query' => [
'match_all' => []
]
]
];
$client->search($searchParams);
But what I would like to do is:
$client = OpenSearch\ClientBuilder::create()->setHosts(["localhost:1"])->setRetries(0)->build();
$searchParams = [
'index' => 'test',
"sort" => [
[ "rating" => ["order" => "desc" , "ignore_unmapped" => true] ],
[ "price" => ["order" => "asc" , "missing" => "_last" , "ignore_unmapped" => true] ]
],
'body' => [
'query' => [
'match_all' => []
]
]
];
$client->search($searchParams);
@Dgame I think this is a fair request, let me see if OpenSearch supports these kinds of sort parameters and i'll update this issue.
@Dgame You should be able to move the sort into body and then it should work as expected. The sort in the first level is the query string based sorting which does not support that
Is your feature request related to a problem?
I would like to ignore unmapped or missing field, which is currently not possible (at least not according to the documentation)
What solution would you like?
Allow to ignore missing / unmapped fields
What alternatives have you considered?
There is currently no alternative
Do you have any additional context?
The documentation states that the sort works like this
But there is currently not way to express something like this:
missing
andignore_unmapped
are not possible according to the documentation.