Following code returns garbage for some values:
for (SearchHit result : output) {
for (Object value : result.getSortValues()) { // result.getSortValues() returns object array
System.out.println(value.toString());
}
}
Following code returns garbage for some values:
for (SearchHit result : output) {
for (Object value : result.getSortValues()) { // result.getSortValues() returns object array
System.out.println(value.toString());
}
}
Has anyone used getSortValues()/ SortValues() Java APIs before ? Return type of this API is an object array and converting these objects to string doesn't always work.
Take this use case for example - If you have applied "filtered" sorting in your query and someone of the results don't satisfy the filter criteria, the value of sroted values should be null. Instead of null, getSortValues()/ SortValues() API is returning some junk value.
Also, if I check the "type" of object returned by this API, it is of type - org.elasticsearch.common.text.StringAndBytesText.
My question is, why this API returns object array and not String array ?
© 2020. All Rights Reserved - Elasticsearch
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.