src/Subscriber/PaginateElasticaQuerySubscriber.php
protected function setSorting(ItemsEvent $event)
    {
        $options = $event->options;
        $sortField = $this->getRequest()->get($options['sortFieldParameterName']);

        if (!$sortField && isset($options['defaultSortFieldName'])) {
            $sortField = $options['defaultSortFieldName'];
        }

        if (!empty($sortField)) {
            $event->target->getQuery()->setSort([
                $sortField => $this->getSort($sortField, $options),
            ]);
        }
    }
protected function setSorting(ItemsEvent $event)
    {
        $options = $event->options;
        $sortField = $this->getRequest()->get($options['sortFieldParameterName']);

        if (!$sortField && isset($options['defaultSortFieldName'])) {
            $sortField = $options['defaultSortFieldName'];
        }

        if (!empty($sortField)) {
            $event->target->getQuery()->setSort([
                $sortField => $this->getSort($sortField, $options),
            ]);
        }
    }
Adds knp paging sort to query.

@param ItemsEvent $event