Elasticsearch Java Client 8.7 String List to FieldAndFormat List

How do I pass Java String List to .fields as FieldAndFormat in search(req -> req.index(index).fields())

Hi @tcpeiris

Are you looking for it?

var list = List.of(
    FieldAndFormat.of(ff -> ff.field("fieldA")),
    FieldAndFormat.of(ff -> ff.field("timestamp").format("epoch_millis")));

var request = SearchRequest.of(sr -> sr
1 Like

Hi. This is exactly what I was looking for. Thank you very much.

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