Package org.elasticsearch.action.admin.indices.mapping.put

Examples of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder.execute()


            //Put the schema/mapping
            log.info("Put Mapping for ["+indexName+"]/["+indexType+"]="+stringMappingJSON);
            PutMappingRequestBuilder putMappingRequestBuilder = client.admin().indices().preparePutMapping(indexName).setType(indexType);
            putMappingRequestBuilder.setSource(stringMappingJSON);
            PutMappingResponse response = putMappingRequestBuilder.execute().actionGet();

            if(!response.isAcknowledged()) {
                log.info("Could not define mapping for type ["+indexName+"]/["+indexType+"]");
            } else {
                log.info("Successfully put mapping for ["+indexName+"]/["+indexType+"]");
View Full Code Here


          @Override
          public ListenableActionFuture<PutMappingResponse> execute(Client client, String indexName) {
            PutMappingRequestBuilder request = client.admin().indices().preparePutMapping(indexName);
            request.setType(typeMapping.getTypeAlias());
            typeMapping.getMappingSource().setSource(request);
            return request.execute();
          }

        });

    // TODO handle response
View Full Code Here

    } else if (mapping instanceof Map) {
      requestBuilder.setSource((Map) mapping);
    } else if (mapping instanceof XContentBuilder) {
      requestBuilder.setSource((XContentBuilder) mapping);
    }
    return requestBuilder.execute().actionGet().isAcknowledged();
  }

  @Override
  public Map getMapping(String indexName, String type) {
    Assert.notNull(indexName, "No index defined for putMapping()");
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.