1

I try to compress the bulk insert into ElasticSearch but I have some trouble.

I have no idea how to do it.

There is the code :

 val client = HttpClient(ElasticsearchClientUri("localhost", 9200))

 client.execute {
    bulk(
      indexInto("myindex" / "mytype").fields("country" -> "Mongolia", "capital" -> "Ulaanbaatar"),
      indexInto("myindex" / "mytype").fields("country" -> "Namibia", "capital" -> "Windhoek")
    )
 }

Thanks for your help

Lip
  • 91
  • 1
  • 9
  • How did you try to compress it exactly? – sksamuel Apr 04 '18 at 19:41
  • About the compression : Elastic search support Compression if you set the compression in headers `Content-Encoding` So you need to compresse the body int Gzip for example and add the headers `Content-Encoding:gzip` – Lip Apr 05 '18 at 11:59
  • Right but I was wondering how you tried to do it in elastic4s. The answer is you didn't, but you're asking how you _could_ do it. – sksamuel Apr 05 '18 at 22:32
  • yes you can do it with elastic 4s you need: - in elastic4s client add the header - overide execute methode and compress the bulk – Lip Apr 10 '18 at 09:04

0 Answers0