Upsert data update response.

@param source the source
@param index  the index
@param type   the type
@param id     the id
@return the update response
512411
public UpdateResponse upsertData(Map<String, ?> source, String index,
            String type, String id) {
        return upsertQuery(buildPrepareUpsert(index, type, id, source));
    }
342762
public void createIndex(String index, boolean ignoreErrors, String indexSettings) throws IOException {
        logger.debug("create index [{}]", index);
        logger.trace("index settings: [{}]", indexSettings);

        try {
            Response response = lowLevelClient.performRequest("PUT", "/" + index,
                    Collections.emptyMap(), createEntity(indexSettings));
            logger.trace("create index response: {}", asMap(response));
        } catch (ResponseException e) {
            if (e.getResponse().getStatusLine().getStatusCode() == 400 &&
                    (e.getMessage().contains("index_already_exists_exception"))) {
                if (!ignoreErrors) {
                    throw new RuntimeException("index already exists");
                }
                logger.trace("index already exists. Ignoring error...");
                return;
            }
            throw e;
        }
        waitForHealthyIndex(index);
    }
555954
protected DocumentType upsertType(
            String reference,
            String name,
            ExecutionContext executionContext) {

        DocumentType documentType = documentTypeRepository.findByReference(reference);
        if(documentType != null) {
            documentType.setName(name);
        } else {
            documentType = documentTypeRepository.create(reference, name);
        }
        return executionContext.addResult(this, documentType);
    }
1141491
private Void indexUpdate(Collection<Consumer<Void>> state, Consumer<Void> indexAction) {
        if (async) {
            state.add(indexAction);
        } else {
            indexAction.accept(null);
        }
        return null;
    }
1272155
@PutAction("{model}")
    public void update(@DbBind MODEL_TYPE model, MODEL_TYPE data) {
        $.merge(data).filter("-id").to(model);
        dao.save(model);
    }
360964
public ActionFuture<IndexResponse> sendDataAsync(
            Map<String, ?> source, String index, String type, String id) {
        return indexQueryAsync(buildIndexRequest(source, index, type, id));
    }
1008347
public void deleteByQuery(String index, String type) throws IOException {
        logger.debug("deleteByQuery [{}]/[{}]", index, type);

        String deleteByQuery = "{\n" +
                "  \"query\": {\n" +
                "    \"match_all\": {}\n" +
                "  }\n" +
                "}";

        HttpEntity entity = EntityBuilder.create().setText(deleteByQuery).setContentType(ContentType.APPLICATION_JSON).build();
        Response restResponse = lowLevelClient.performRequest("POST", "/" + index + "/" + type + "/_delete_by_query", Collections.emptyMap(), entity);
        Map<String, Object> response = asMap(restResponse);
        logger.debug("reindex response: {}", response);
    }
296365
public WriteResult<T, K> updateById(K id, DBUpdate.Builder update) throws MongoException {
        return this.update(createIdQuery(id), update.serialiseAndGet(objectMapper));
    }
1126608
public String sendData(String jsonSource, String index, String type) {
        return sendData(jsonSource, index, type, null).getId();
    }
1341520
void update(long index, int b)
    {
        if (size > 0)
        {
            assert index <= hi;
            if (index < lo)
            {
                throw new IllegalStateException("lookaheadLength() too small in ChecksumProvider implementation");
            }
            hi = index;
            if ((lo == hi - size))
            {
                checksum.update(lookahead[(int)(lo % size)]);
                lo++;
            }
            lookahead[(int)(hi++ % size)] = b;
        }
        else
        {
            if (index == hi)
            {
                checksum.update(b);
                hi = index+1;
            }
            else
            {
                if (index != hi -1)
                {
                    throw new IllegalStateException("lookahead needed for checksum");
                }
            }
        }
    }
782183
@SuppressWarnings("unchecked")
	@Override
	public int update(final Object entity) {
		@SuppressWarnings("rawtypes")
		EntityHandler handler = this.getEntityHandler();
		if (!handler.getEntityType().isInstance(entity)) {
			throw new IllegalArgumentException("Entity type not supported");
		}

		try {
			Class<?> type = entity.getClass();
			TableMetadata metadata = handler.getMetadata(this.transactionManager, type);
			SqlContext context = handler.createUpdateContext(this, metadata, type, true);
			context.setSqlKind(SqlKind.UPDATE);
			handler.setUpdateParams(context, entity);
			int count = handler.doUpdate(this, context, entity);

			if (count == 0 && MappingUtils.getVersionMappingColumn(type).isPresent()) {
				throw new OptimisticLockException(context);
			}
			return count;
		} catch (SQLException e) {
			throw new EntitySqlRuntimeException(SqlKind.UPDATE, e);
		}
	}
1242554
public <P extends ParaObject> P read(String type, String id) {
		if (StringUtils.isBlank(type) || StringUtils.isBlank(id)) {
			return null;
		}

		return getEntity(invokeGet(type.concat("/").concat(id), null), ParaObjectUtils.toClass(type));
	}
199159
public QueryParameters updateType(String key, Integer type) {
        this.types.put(processKey(key), type);

        return this;
    }
487319
public boolean createIndex(String name, String type, EsRequest mappings) throws IOException {
        if (indexExists(name)) {
            return true;
        }

        CloseableHttpClient client = HttpClients.createDefault();
        HttpPost method = new HttpPost(String.format("http://%s:%d/%s", host, port, name));
        try {
            StringEntity requestEntity = new StringEntity(mappings.toString(), ContentType.APPLICATION_JSON);
            method.setEntity(requestEntity);
            CloseableHttpResponse resp = client.execute(method);
            return resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK;
        } finally {
            method.releaseConnection();
        }
    }
1028946
public void updateUpdate(String type, String location) throws SecurityException {
	checkWriteAccess();

	if (!(config instanceof ConfigServer)) {
	    throw new SecurityException("can't change update setting from this context, access is denied");
	}
	Element update = _getRootElement("update");
	update.setAttribute("type", type);
	try {
	    location = HTTPUtil.toURL(location, true).toString();
	}
	catch (Throwable e) {
	    ExceptionUtil.rethrowIfNecessary(e);
	}
	update.setAttribute("location", location);
    }
1077187
public void updateFile(int fileId, FileUpdate update) {
		getResourceFactory().getApiResource("/file/" + fileId)
				.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
	}
651488
public int reindex(String sourceIndex, String sourceType, String targetIndex) throws IOException {
        logger.debug("reindex [{}]/[{}] -> [{}]/[doc]", sourceIndex, sourceType, targetIndex);

        String reindexQuery = "{  \"source\": {\n" +
                "    \"index\": \"" + sourceIndex + "\",\n" +
                "    \"type\": \"" + sourceType + "\"\n" +
                "  },\n" +
                "  \"dest\": {\n" +
                "    \"index\": \"" + targetIndex + "\",\n" +
                "    \"type\": \"doc\"\n" +
                "  }\n" +
                "}\n";

        logger.trace("{}", reindexQuery);

        HttpEntity entity = EntityBuilder.create().setText(reindexQuery).setContentType(ContentType.APPLICATION_JSON).build();
        Response restResponse = lowLevelClient.performRequest("POST", "/_reindex", Collections.emptyMap(), entity);
        Map<String, Object> response = asMap(restResponse);
        logger.debug("reindex response: {}", response);

        return (response == null ? -1 : (int) response.get("total"));
    }