本文整理匯總了Java中org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest.type方法的典型用法代碼示例。如果您正苦於以下問題:Java PutMappingRequest.type方法的具體用法?Java PutMappingRequest.type怎麽用?Java PutMappingRequest.type使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest
的用法示例。
在下文中一共展示了PutMappingRequest.type方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: prepareRequest
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; //導入方法依賴的package包/類
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
PutMappingRequest putMappingRequest = putMappingRequest(Strings.splitStringByCommaToArray(request.param("index")));
putMappingRequest.type(request.param("type"));
putMappingRequest.source(request.content(), request.getXContentType());
putMappingRequest.updateAllTypes(request.paramAsBoolean("update_all_types", false));
putMappingRequest.timeout(request.paramAsTime("timeout", putMappingRequest.timeout()));
putMappingRequest.masterNodeTimeout(request.paramAsTime("master_timeout", putMappingRequest.masterNodeTimeout()));
putMappingRequest.indicesOptions(IndicesOptions.fromRequest(request, putMappingRequest.indicesOptions()));
return channel -> client.admin().indices().putMapping(putMappingRequest, new AcknowledgedRestListener<>(channel));
}
示例2: handleRequest
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; //導入方法依賴的package包/類
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
PutMappingRequest putMappingRequest = putMappingRequest(Strings.splitStringByCommaToArray(request.param("index")));
putMappingRequest.type(request.param("type"));
putMappingRequest.source(request.content().toUtf8());
putMappingRequest.updateAllTypes(request.paramAsBoolean("update_all_types", false));
putMappingRequest.reindex(request.paramAsBoolean("reindex", false));
putMappingRequest.timeout(request.paramAsTime("timeout", putMappingRequest.timeout()));
putMappingRequest.masterNodeTimeout(request.paramAsTime("master_timeout", putMappingRequest.masterNodeTimeout()));
putMappingRequest.indicesOptions(IndicesOptions.fromRequest(request, putMappingRequest.indicesOptions()));
client.admin().indices().putMapping(putMappingRequest, new AcknowledgedRestListener<PutMappingResponse>(channel));
}
示例3: testCreateMapping
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; //導入方法依賴的package包/類
@Test
public void testCreateMapping() throws Exception {
PutMappingRequest putMappingRequest = new PutMappingRequest();
putMappingRequest.indices("blog");
putMappingRequest.type("");
client.admin().indices().putMapping(putMappingRequest);
}
示例4: putMapping
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; //導入方法依賴的package包/類
private static Request putMapping(final PutMappingRequest putMappingRequest) {
final String endpoint = "/" + putMappingRequest.indices()[0] + "/_mapping/" + putMappingRequest.type();
final ByteArrayEntity entity = new ByteArrayEntity(putMappingRequest.source().getBytes(),
ContentType.APPLICATION_JSON);
return new Request(HttpPut.METHOD_NAME, endpoint, Collections.emptyMap(), entity);
}