Hello, according to the inline documentation for sorting in the elasticsearch-php client, in order to use sorting it is described as thus:
['sort'] = (list) A comma-separated list of <field>:<direction> pairs
How do you add additional sort options such as: "ignore_unmapped": true as described here: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html#geo-sorting ?
I tried formatting the sort options like this:
[
"sort" => [
"publish_date" => [
"order" => "desc",
"ignore_unmapped" => true
]
]
]
but this resulted in a request contains unrecognized parameters: [sort[publish_date][ignore_unmapped]] error.
Alpine 3.7.07.1.20v6.0.16.4.0You may put publish_date in an array:
[
"sort" => [
[
"publish_date" => ["order" => "desc", "ignore_unmapped" => true]
]
]
]
Thanks. I'll give that a try.
IMPORTANT: If you want to use more advanced sorting don't use the sort parameter of the elasticsearch php client but instead put sort under body. Just lost 1h figuring this out :).
I ended up having to put the sort parameter under the body before it worked for me. Thanks for the heads up @hacfi
Most helpful comment
IMPORTANT: If you want to use more advanced sorting don't use the
sortparameter of the elasticsearch php client but instead putsortunderbody. Just lost 1h figuring this out :).