org.elasticsearch.search.sort
Class FieldSortBuilder
java.lang.Object
org.elasticsearch.search.sort.SortBuilder
org.elasticsearch.search.sort.FieldSortBuilder
- All Implemented Interfaces:
- ToXContent
public class FieldSortBuilder
- extends SortBuilder
A sort builder to sort based on a document field.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FieldSortBuilder
public FieldSortBuilder(String fieldName)
- Constructs a new sort based on a document field.
- Parameters:
fieldName
- The field name.
order
public FieldSortBuilder order(SortOrder order)
- The order of sorting. Defaults to
SortOrder.ASC
.
- Specified by:
order
in class SortBuilder
missing
public FieldSortBuilder missing(Object missing)
- Sets the value when a field is missing in a doc. Can also be set to _last or
_first to sort missing last or first respectively.
- Specified by:
missing
in class SortBuilder
ignoreUnmapped
public FieldSortBuilder ignoreUnmapped(boolean ignoreUnmapped)
- Sets if the field does not exists in the index, it should be ignored and not sorted by or not. Defaults
to false (not ignoring).
toXContent
public XContentBuilder toXContent(XContentBuilder builder,
ToXContent.Params params)
throws IOException
- Throws:
IOException
Copyright © 2009-2012. All Rights Reserved.