update

in elasticsearch-persistence/lib/elasticsearch/persistence/repository/store.rb [62:77]


        def update(document_or_id, options = {})
          if document_or_id.is_a?(String) || document_or_id.is_a?(Integer)
            id = document_or_id
            body = options
          else
            document = serialize(document_or_id)
            id = __extract_id_from_document(document)
            if options[:script]
              body = options
            else
              body = { doc: document }.merge(options)
            end
          end
          client.update(index: index_name, id: id, body: body)
        end