I am trying to do sorting by more than one fields with CustomScoreQueryBuilder.script(). I looked at the document at http://www.elasticsearch.com/docs/elasticsearch/modules/scripting/ but couldn't find any example for doing that. Looks like the most common type of scripts is:
doc['field_name'].value
If I want to sort by field A first, then by field B, how do I write such a script? Is it possible at all?
In order to sort first by field A, and then by field B, you don't have to
use scripting, just specify those fields as the ones to sort by. In Java,
simply call SearchRequestBuilder#addSort twice, once for fieldA, and once
for fieldB.
I am trying to do sorting by more than one fields with
CustomScoreQueryBuilder.script(). I looked at the document at http://www.elasticsearch.com/docs/elasticsearch/modules/scripting/ but
couldn't find any example for doing that. Looks like the most common type
of
scripts is:
doc['field_name'].value
If I want to sort by field A first, then by field B, how do I write such a
script? Is it possible at all?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.