Get the correct encoding Elasticsearch configuration file

How can I use the Elasticsearch API APIs to get the index configuration in json format correctly encoded?

I tried to request the admin.indices client using GetMappingRequest. However, the display format always has strange characters - I tried ISO8559, ASCII, UTF-8, UTF-16:

val bs = new ByteArrayOutputStream()
client.admin.indices.getMappings(new GetMappingsRequest()).get.writeTo(new OutputStreamStreamOutput(bs))
val mapping = new String(bs.toByteArray, CharSet.UTF8)
println(mapping)

Answer:

{"_all@enabled":false},"_tt tru ype@1
index":"no" .   properties@valu`$ ,"string", 4}}}dateOptionalTimeoffers42c9e293decoratedOfferd
+4
source share

Source: https://habr.com/ru/post/1544185/


All Articles