elastix icon indicating copy to clipboard operation
elastix copied to clipboard

Support for Document Partial Updates

Open robvolk opened this issue 8 years ago • 2 comments

I'd like to use Elastic's Update API to make partial or scripted update to an existing document. Any plans on adding this? thanks in advance!

robvolk avatar Jan 24 '17 04:01 robvolk

Here's the code I used and I'll try to open a PR at some point:

uri = "#{Elastix.config(:uri)}/index_name/type/#{id}/_update"
    body = %{
      script: %{
        inline: "ctx._source.tags.add(params.tag)",
        lang: "painless",
        params: %{
          tag: %{
            name: name,
          }
        }
      }
    }

    {_, response} = Elastix.HTTP.post(uri, Poison.encode!(body))

robvolk avatar Feb 04 '17 02:02 robvolk

Would be a good next feature! I'll milestone it for the next version.

werbitzky avatar Mar 01 '17 14:03 werbitzky