Class ScoreSortBuilder

java.lang.Object
org.elasticsearch.search.sort.SortBuilder<ScoreSortBuilder>
org.elasticsearch.search.sort.ScoreSortBuilder
All Implemented Interfaces:
NamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject, Rewriteable<SortBuilder<?>>

public class ScoreSortBuilder
extends SortBuilder<ScoreSortBuilder>
A sort builder allowing to sort by score.
  • Field Details

  • Constructor Details

    • ScoreSortBuilder

      public ScoreSortBuilder()
      Build a ScoreSortBuilder default to descending sort order.
    • ScoreSortBuilder

      public ScoreSortBuilder​(StreamInput in) throws java.io.IOException
      Read from a stream.
      Throws:
      java.io.IOException
  • Method Details

    • writeTo

      public void writeTo​(StreamOutput out) throws java.io.IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Throws:
      java.io.IOException
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Throws:
      java.io.IOException
    • fromXContent

      public static ScoreSortBuilder fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser, java.lang.String fieldName)
      Creates a new ScoreSortBuilder from the query held by the XContentParser in XContent format.
      Parameters:
      parser - the input parser. The state on the parser contained in this context will be changed as a side effect of this method call
      fieldName - in some sort syntax variations the field name precedes the xContent object that specifies further parameters, e.g. in '{ "foo": { "order" : "asc"} }'. When parsing the inner object, the field name can be passed in via this argument
    • build

      public SortFieldAndFormat build​(SearchExecutionContext context)
      Description copied from class: SortBuilder
      Create a SortFieldAndFormat from this builder.
      Specified by:
      build in class SortBuilder<ScoreSortBuilder>
    • buildBucketedSort

      public BucketedSort buildBucketedSort​(SearchExecutionContext context, BigArrays bigArrays, int bucketSize, BucketedSort.ExtraData extra) throws java.io.IOException
      Description copied from class: SortBuilder
      Create a BucketedSort which is useful for sorting inside of aggregations.
      Specified by:
      buildBucketedSort in class SortBuilder<ScoreSortBuilder>
      Throws:
      java.io.IOException
    • equals

      public boolean equals​(java.lang.Object object)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • getWriteableName

      public java.lang.String getWriteableName()
      Description copied from interface: NamedWriteable
      Returns the name of the writeable object
    • rewrite

      public ScoreSortBuilder rewrite​(QueryRewriteContext ctx) throws java.io.IOException
      Description copied from interface: Rewriteable
      Rewrites this instance based on the provided context. The returned objects will be the same instance as this if no changes during the rewrite were applied.
      Throws:
      java.io.IOException