1

I want to delete only one particular field and value in elasticsearch using elastic4s library. However, all I see everywhere is different mechanisms to delete the whole document. Can anyone help? is this supported?

208rishabh
  • 96
  • 11

2 Answers2

0

You have to use an update script to remove a field when you're doing an update, eg

"script" : "ctx._source.remove(\"name_of_field\")" }'
sksamuel
  • 16,154
  • 8
  • 60
  • 108
0

I could solve this issue with following command in elatic4s (version 6.5.1):

client.execute { deleteByQuery("myindex", "mytype", matchQuery("key", "valuexy")) }

this deletes documents containing entries with "key -> valuexy".

Gschmaaz
  • 61
  • 5