use of io.searchbox.indices.mapping.PutMapping in project unipop by unipop-graph.
the class ElasticClient method validateNested.
public JestResult validateNested(String index, String type, String path) {
PutMapping putMapping = new PutMapping.Builder(index, type, "{ \"" + type + "\" : { \"properties\" : { \"" + path + "\" : {\"type\" : \"nested\"} } } }").build();
logger.info("putting mapping for nested, mapping: {}", putMapping);
return execute(putMapping);
}
use of io.searchbox.indices.mapping.PutMapping in project dq-easy-cloud by dq-open-cloud.
the class TransportClient method createIndexMapping.
/**
* Put映射
*
* @throws Exception
*/
@Test
public void createIndexMapping() throws Exception {
String source = "{\"" + typeName + "\":{\"properties\":{" + "\"author\":{\"type\":\"string\",\"index\":\"not_analyzed\"}" + ",\"title\":{\"type\":\"string\"}" + ",\"content\":{\"type\":\"string\"}" + ",\"price\":{\"type\":\"string\"}" + ",\"view\":{\"type\":\"string\"}" + ",\"tag\":{\"type\":\"string\"}" + ",\"date\":{\"type\":\"date\",\"format\":\"yyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis\"}" + "}}}";
System.out.println(source);
PutMapping putMapping = new PutMapping.Builder(indexName, typeName, source).build();
JestResult jr = jestClient.execute(putMapping);
System.out.println(jr.isSucceeded());
}
use of io.searchbox.indices.mapping.PutMapping in project pancm_project by xuwujing.
the class User method insert.
/**
* 新增数据
* @param indexName
* @param typeName
* @param source
* @return
* @throws Exception
*/
public boolean insert(JestClient jestClient, String indexName, String typeName, String source) throws Exception {
PutMapping putMapping = new PutMapping.Builder(indexName, typeName, source).build();
JestResult jr = jestClient.execute(putMapping);
return jr.isSucceeded();
}
Aggregations