0

I am using kotlin/java for android. For a module I have to make request to our elasticsearch instance. For multiple queries _msearch elastic search accepts nd-json format.

{} // Index defined here
{} // Query and other settings here
// Repeat for other indexes

Currently I am working around it using a hardcoded string in json format where I change add the needed changes in request with;

"""
{}
{... ${Optional Key:Value as string} ... ${Optional Key:Value as string}}

""".trimIndent().toRequestBody("application/x-ndjson".toMediaTypeOrNull())

I want to know the proper/better way to do it, as you'd do it using serialisable/deserialisable class.

vhmvd
  • 192
  • 3
  • 15

0 Answers0