ElasticSearch JAVA create custom sort in place of attribute value sort

For example, I have 6 accounts (1,2,34,5,6)of transactions in index and I want to search transactions and sort by order by account 4,6,3,2,1,5(custom order ) then how I can use it .

SearchResponse<MyClass> esResponse = esClient.search((s -> s
                 .query(q -> q
                     .terms(t -> t
                         .terms(tqf -> tqf.value(/* List<String> here */))
                 ).sort(so -> so
                     .field(FieldSort.of(f -> f     **`<<- is there a way , I can pass customized acc order`** 
             ), MyClass.class);

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.