I created an IndicesRequest in Java client elasticsearch 8.
I noticed there is a method co.elastic.clients.json.WithJson.withJso : co.elastic.clients.json.WithJson.withJso in order to append parameters to the request.
I am trying to use that method withJson(Reader input) in order to append “s” parameter for sorting the results by index creation date.
These are all the different options that I tried but nothing worked for me and I am getting the exception: Class class co.elastic.clients.elasticsearch.cat.IndicesRequest cannot be read from JSON
Reader stringReader = new StringReader("{"s": "creation.date.string:desc"}");
Reader stringReader2 = new StringReader(""s=creation.date.string:desc"");
Reader stringReader3 = new StringReader(""&s=creation.date.string:desc"");
Reader stringReader4 = new StringReader("&s=creation.date.string:desc");
Reader stringReader5 = new StringReader("creation.date.string:desc");
Reader stringReader6 = new StringReader("{"s": "creation.date.string":"desc"}");
Reader stringReader7 = new StringReader("{"creation.date.string":"desc"}");
Reader stringReader8 = new StringReader("{"s"= "creation.date.string":"desc"}");
here I sent the different variation of stringReader in order to create the request but got an exception:
IndicesRequest request = IndicesRequest.of(ir -> ir.index(patterns).withJson(stringReaderX));
Does anyone tried that API and can help?