org.elasticsearch.search.sort
Class FieldSortBuilder

java.lang.Object
  extended by org.elasticsearch.search.sort.SortBuilder
      extended by org.elasticsearch.search.sort.FieldSortBuilder
All Implemented Interfaces:
ToXContent

public class FieldSortBuilder
extends SortBuilder

A sort builder to sort based on a document field.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
FieldSortBuilder(String fieldName)
          Constructs a new sort based on a document field.
 
Method Summary
 FieldSortBuilder ignoreUnmapped(boolean ignoreUnmapped)
          Sets if the field does not exists in the index, it should be ignored and not sorted by or not.
 FieldSortBuilder missing(Object missing)
          Sets the value when a field is missing in a doc.
 FieldSortBuilder order(SortOrder order)
          The order of sorting.
 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldSortBuilder

public FieldSortBuilder(String fieldName)
Constructs a new sort based on a document field.

Parameters:
fieldName - The field name.
Method Detail

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.