Skip to content

How to include additional sort options using elasticsearch-php client #816

Closed
@kabudu

Description

@kabudu

Summary of problem or feature request

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 ?

Code snippet of problem

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.

System details

  • Operating System: Alpine 3.7.0
  • PHP Version: 7.1.20
  • ES-PHP client version: v6.0.1
  • Elasticsearch version: 6.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions