Class IndexSortConfig


public final class IndexSortConfig extends Object
Holds all the information that is used to build the sort order of an index. The index sort settings are final and can be defined only at index creation. These settings are divided in four lists that are merged during the initialization of this class:
  • `index.sort.field`: the field or a list of field to use for the sort
  • `index.sort.order` the SortOrder to use for the field or a list of SortOrder for each field defined in `index.sort.field`.
  • `index.sort.mode`: the MultiValueMode to use for the field or a list of orders for each field defined in `index.sort.field`.
  • `index.sort.missing`: the missing value to use for the field or a list of missing values for each field defined in `index.sort.field`
  • Field Details


      public static final Setting<List<String>> INDEX_SORT_FIELD_SETTING
      The list of field names

      public static final Setting<List<SortOrder>> INDEX_SORT_ORDER_SETTING
      The SortOrder for each specified sort field (ie. asc or desc).

      public static final Setting<List<MultiValueMode>> INDEX_SORT_MODE_SETTING
      The MultiValueMode for each specified sort field (ie. max or min).

      public static final Setting<List<String>> INDEX_SORT_MISSING_SETTING
      The missing value for each specified sort field (ie. _first or _last)
  • Constructor Details

    • IndexSortConfig

      public IndexSortConfig(IndexSettings indexSettings)
  • Method Details

    • hasIndexSort

      public boolean hasIndexSort()
      Returns true if the index should be sorted
    • hasPrimarySortOnField

      public boolean hasPrimarySortOnField(String field)
    • buildIndexSort

      public buildIndexSort(Function<String,MappedFieldType> fieldTypeLookup, BiFunction<MappedFieldType,Supplier<SearchLookup>,IndexFieldData<?>> fieldDataLookup)
      Builds the Sort order from the settings for this index or returns null if this index has no sort.
    • getSortFieldType

      public static getSortFieldType( sortField)