0

I'm trying to update a document by adding/updating an array of objects, using client.execute { update ... }, but I'm having issues trying to pass in key value pairs in Elastic4s. I can't find any documentation on ctx._source, except for this which says nothing.

val store_reservation_response_future = client.execute {

    update(ota_id) in "rsconfig/ota" script "ctx._source.developers =
    [key]" params(Map("key" -> "value"))

}

The preceding code puts the following in the db:

"developers": [ "value" ]

I tried:

params(Map("key" -> (Map("key1" -> "value"))))

But I get the following error:

background log: error: Caused by: java.io.IOException: Can't write type [class scala.collection.immutable.Map$Map1]

How do I add a key value pair?

I found a java solution, but it did not help me.

If there is any documentation someone can point me to, I would greatly appreciate the help.

krzasteka
  • 427
  • 1
  • 4
  • 14
  • Did you try converting the map to a java map before using it ? – sksamuel Oct 24 '15 at 21:32
  • I'm trying to stick strictly to Scala. – krzasteka Oct 25 '15 at 21:48
  • Yes but sometimes you need to use java collections to interface with things that are based on Java, as elastic4s is. If you try it, and it works, then I can add special support to elastic4s to do the conversion for you. – sksamuel Oct 28 '15 at 00:46
  • Thanks, I just realized who is writing these comments. I will update you once I try it out. – krzasteka Oct 29 '15 at 16:16

0 Answers0