Skip to content

Index#order - add missing first/last option #924

@ChrisKaun

Description

@ChrisKaun

Is your feature request related to a problem? Please describe.

I have a use case where a index should return records ordered by a string field, though records with an empty value must be returned first.
Lets assume an index with Person instances that have a first_name field.

Person.new(first_name: 'A')
Person.new(first_name: 'Z') 
Person.new(first_name: null/nil)

The index query should return the person without a first_name first, regardless of the order direction (ascending/descending).

Describe the solution you'd like

The elasticsearch documentation lists an missing-option which would be ideal for my use case.

Additional context

Maybe this option already exists and it's not documented in chewy, but even by looking throught the documentation I couldn't find it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions