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
                 .index("loans")
                 .size(pageSize)
                 .from(page)
                 .query(q -> q
                     .terms(t -> t
                         .field("ic_number.keyword")
                         .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`** 
                         .field("date_created")
                         .order(SortOrder.Desc)
                     ))
                 )
             ), MyClass.class);

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