Examples of PutMappingRequest


Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

        final ActionFuture<CreateIndexResponse> createFuture = c.admin().indices().create(cir);
        final boolean acknowledged = createFuture.actionGet().isAcknowledged();
        if (!acknowledged) {
            return false;
        }
        final PutMappingRequest mappingRequest = Mapping.getPutMappingRequest(c, indexName, configuration.getElasticSearchAnalyzer());
        return c.admin().indices().putMapping(mappingRequest).actionGet().isAcknowledged();
    }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

     * @param indices The indices to create mapping. Use <tt>null</tt> or <tt>_all</tt> to execute against all indices
     * @return The create mapping request
     * @see org.elasticsearch.client.IndicesAdminClient#putMapping(org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest)
     */
    public static PutMappingRequest putMappingRequest(String... indices) {
        return new PutMappingRequest(indices);
    }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

        controller.registerHandler(POST, "/{index}/_mapping", this);
        controller.registerHandler(POST, "/{index}/{type}/_mapping", this);
    }

    @Override public void handleRequest(final RestRequest request, final RestChannel channel) {
        PutMappingRequest putMappingRequest = putMappingRequest(splitIndices(request.param("index")));
        putMappingRequest.type(request.param("type"));
        putMappingRequest.source(request.contentAsString());
        putMappingRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
        putMappingRequest.ignoreConflicts(request.paramAsBoolean("ignore_conflicts", putMappingRequest.ignoreConflicts()));
        client.admin().indices().putMapping(putMappingRequest, new ActionListener<PutMappingResponse>() {
            @Override public void onResponse(PutMappingResponse response) {
                try {
                    XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                    builder.startObject()
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

* @author kimchy (shay.banon)
*/
public class PutMappingRequestBuilder extends BaseIndicesRequestBuilder<PutMappingRequest, PutMappingResponse> {

    public PutMappingRequestBuilder(IndicesAdminClient indicesClient) {
        super(indicesClient, new PutMappingRequest());
    }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

*/
@SuppressWarnings("unused")
public class PutMappingRequestBuilder<JsonInput, JsonOutput> extends AbstractRequestBuilderJsonOutput<PutMappingRequest, PutMappingResponse, JsonInput, JsonOutput> {

    public PutMappingRequestBuilder(Client client, JsonToString<JsonInput> jsonToString, StringToJson<JsonOutput> stringToJson) {
        super(client, new PutMappingRequest(), jsonToString, stringToJson);
    }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

                // todo when conflict is detected, delete old mapping (this will delete all indexes as well, so should warn user)
                if (LOG.isDebugEnabled()) {
                    LOG.debug("[" + scm.getElasticTypeName() + "] => " + elasticMapping);
                }
                elasticSearchClient.admin().indices().putMapping(
                        new PutMappingRequest(scm.getIndexName())
                                .type(scm.getElasticTypeName())
                                .source(elasticMapping)
                ).actionGet();
            }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

    _sIndexType = sChild;
    _elasticClient  = client;
   
    try {     
      if (null != sMapping) {
        PutMappingRequest pmr = new PutMappingRequest(_sIndexName).type(_sIndexType).source(sMapping);
       
        // Add mapping to index
        _elasticClient.admin().indices().putMapping(pmr).actionGet();
     
        //(Wait for above operation to be completed)
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

    String indexName = mapper.getIndexName();
    String typeName = mapper.getTypeName();

    try {
      Logger.debug("Create Elastic Search Type %s/%s", indexName, typeName);
      PutMappingRequest request = Requests.putMappingRequest(indexName).type(typeName);
      XContentBuilder mapping = MappingUtil.getMapping(mapper);
      Logger.debug("Type mapping: \n %s", mapping.string());
      request.source(mapping);
      PutMappingResponse response = client.admin().indices().putMapping(request).actionGet();
      Logger.debug("Response: %s", response);

    } catch (IndexAlreadyExistsException iaee) {
      Logger.debug("Index already exists: %s", indexName);
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

        // need to merge the _meta part of the mapping mapping before-hand because ES doesn't
        // update the _meta column recursively. Instead it is overwritten and therefore partitioned by
        // and collection_type information would be lost.
        String[] indexNames = getIndexNames(analysis.table(), analysis.partitionName().orNull());
        PutMappingRequest request = new PutMappingRequest();
        request.indices(indexNames);
        request.type(Constants.DEFAULT_MAPPING_TYPE);
        IndexMetaData indexMetaData = clusterService.state().getMetaData().getIndices().get(indexNames[0]);
        try {
            Map mergedMeta = (Map)indexMetaData.getMappings()
                    .get(Constants.DEFAULT_MAPPING_TYPE)
                    .getSourceAsMap()
                    .get("_meta");
            if (mergedMeta != null) {
                XContentHelper.update(mergedMeta, (Map) mapping.get("_meta"));
                mapping.put("_meta", mergedMeta);
            }
            request.source(mapping);
        } catch (IOException e) {
            result.setException(e);
        }
        transportPutMappingAction.execute(request, new ActionListener<PutMappingResponse>() {
            @Override
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest

                    }
                });
            }
        }
        if (updateMapping) {
            PutMappingRequest request = new PutMappingRequest(indices);
            request.type(Constants.DEFAULT_MAPPING_TYPE);
            request.source(analysis.tableParameter().mappings());
            final SettableFuture<?> future = SettableFuture.create();
            results.add(future);
            transportPutMappingAction.execute(request, new ActionListener<PutMappingResponse>() {
                @Override
                public void onResponse(PutMappingResponse putMappingResponse) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.