private function buildSortOrder(SortOrderInterface $sortOrder)
    {
        $sortField = $sortOrder->getField();

        $sortOrderConfig = ['order' => $sortOrder->getDirection()];

        if ($sortField !== SortOrderInterface::DEFAULT_SORT_FIELD) {
            $sortOrderConfig['missing']       = $sortOrder->getMissing();
            $sortOrderConfig['unmapped_type'] = FieldInterface::FIELD_TYPE_KEYWORD;
        }

        if ($sortOrder->getType() == SortOrderInterface::TYPE_NESTED) {
            $sortOrderConfig['nested_path']   = $sortOrder->getNestedPath();
            $sortOrderConfig['mode']          = $sortOrder->getScoreMode();

            if ($sortOrder->getNestedFilter()) {
                $sortOrderConfig['nested_filter'] = $this->queryBuilder->buildQuery($sortOrder->getNestedFilter());
            }
        }

        return [$sortField => $sortOrderConfig];
    }