当前位置: 首页>>代码示例>>Java>>正文


Java Action类代码示例

本文整理汇总了Java中org.elasticsearch.action.Action的典型用法代码示例。如果您正苦于以下问题:Java Action类的具体用法?Java Action怎么用?Java Action使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Action类属于org.elasticsearch.action包,在下文中一共展示了Action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
public ActionRequestValidationException validate() {
    ActionRequestValidationException arve = null;
    if (store == null) {
        arve = addValidationError("store must be set", null);
    }
    if (!store.equals(IndexFeatureStore.DEFAULT_STORE) && !store.startsWith(IndexFeatureStore.STORE_PREFIX)) {
        arve = addValidationError("Store name [" + store + "] is invalid.", arve);
    }
    if (storableElement == null) {
        arve = addValidationError("storable element must be set", arve);
    }
    if (action == Action.UPDATE && !storableElement.updatable()) {
        arve = addValidationError("Elements of type [" + storableElement.type() + "] are not updatable.", arve);
    }
    if (updatedVersion != null && action != Action.UPDATE) {
        arve = addValidationError("Only UPDATE supports a version.", arve);
    }
    return arve;
}
 
开发者ID:o19s,项目名称:elasticsearch-learning-to-rank,代码行数:21,代码来源:FeatureStoreAction.java

示例2: doExecute

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
protected <Request extends ActionRequest,
                Response extends ActionResponse,
                RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>>
        void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
    listener.onResponse(null);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:NoOpClient.java

示例3: doExecute

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
protected <     Request extends ActionRequest,
                Response extends ActionResponse,
                RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>
          > void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
    request.setParentTask(parentTask);
    super.doExecute(action, request, listener);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:ParentTaskAssigningClient.java

示例4: execute

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
public final <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> ActionFuture<Response> execute(
        Action<Request, Response, RequestBuilder> action, Request request) {
    PlainActionFuture<Response> actionFuture = PlainActionFuture.newFuture();
    execute(action, request, actionFuture);
    return actionFuture;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:AbstractClient.java

示例5: filterWithHeader

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
public Client filterWithHeader(Map<String, String> headers) {
    return new FilterClient(this) {
        @Override
        protected <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
            ThreadContext threadContext = threadPool().getThreadContext();
            try (ThreadContext.StoredContext ctx = threadContext.stashAndMergeHeaders(headers)) {
                super.doExecute(action, request, listener);
            }
        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:AbstractClient.java

示例6: TransportProxyClient

import org.elasticsearch.action.Action; //导入依赖的package包/类
TransportProxyClient(Settings settings, TransportService transportService,
                            TransportClientNodesService nodesService, List<GenericAction> actions) {
    this.nodesService = nodesService;
    Map<Action, TransportActionNodeProxy> proxies = new HashMap<>();
    for (GenericAction action : actions) {
        if (action instanceof Action) {
            proxies.put((Action) action, new TransportActionNodeProxy(settings, action, transportService));
        }
    }
    this.proxies = unmodifiableMap(proxies);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:TransportProxyClient.java

示例7: doExecute

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
public <    Request extends ActionRequest,
            Response extends ActionResponse,
            RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>
        > void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
    // Discard the task because the Client interface doesn't use it.
    executeLocally(action, request, listener);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:NodeClient.java

示例8: startSlices

import org.elasticsearch.action.Action; //导入依赖的package包/类
public static <
            Request extends AbstractBulkByScrollRequest<Request>
        > void startSlices(Client client, TaskManager taskManager, Action<Request, BulkByScrollResponse, ?> action,
                String localNodeId, ParentBulkByScrollTask task, Request request, ActionListener<BulkByScrollResponse> listener) {
    TaskId parentTaskId = new TaskId(localNodeId, task.getId());
    for (final SearchRequest slice : sliceIntoSubRequests(request.getSearchRequest(), UidFieldMapper.NAME, request.getSlices())) {
        // TODO move the request to the correct node. maybe here or somehow do it as part of startup for reindex in general....
        Request requestForSlice = request.forSlice(parentTaskId, slice);
        ActionListener<BulkByScrollResponse> sliceListener = ActionListener.wrap(
                r -> task.onSliceResponse(listener, slice.source().slice().getId(), r),
                e -> task.onSliceFailure(listener, slice.source().slice().getId(), e));
        client.execute(action, requestForSlice, sliceListener);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:BulkByScrollParallelizationHelper.java

示例9: testSetsParentId

import org.elasticsearch.action.Action; //导入依赖的package包/类
public void testSetsParentId() {
    TaskId[] parentTaskId = new TaskId[] {new TaskId(randomAsciiOfLength(3), randomLong())};

    // This mock will do nothing but verify that parentTaskId is set on all requests sent to it.
    NoOpClient mock = new NoOpClient(getTestName()) {
        @Override
        protected <     Request extends ActionRequest,
                        Response extends ActionResponse,
                        RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>
                    > void doExecute( Action<Request, Response, RequestBuilder> action, Request request,
                        ActionListener<Response> listener) {
            assertEquals(parentTaskId[0], request.getParentTask());
            super.doExecute(action, request, listener);
        }
    };
    try (ParentTaskAssigningClient client = new ParentTaskAssigningClient(mock, parentTaskId[0])) {
        // All of these should have the parentTaskId set
        client.bulk(new BulkRequest());
        client.search(new SearchRequest());
        client.clearScroll(new ClearScrollRequest());

        // Now lets verify that unwrapped calls don't have the parentTaskId set
        parentTaskId[0] = TaskId.EMPTY_TASK_ID;
        client.unwrap().bulk(new BulkRequest());
        client.unwrap().search(new SearchRequest());
        client.unwrap().clearScroll(new ClearScrollRequest());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:ParentTaskAssigningClientTests.java

示例10: doExecute

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
protected <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void doExecute(
    Action<Request, Response, RequestBuilder> action, Request request,
    ActionListener<Response> listener) {
  Tracer.SpanBuilder spanBuilder = tracer.buildSpan(request.getClass().getSimpleName())
      .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT);

  Span span = spanBuilder.start();
  SpanDecorator.onRequest(span);

  ActionListener<Response> actionFuture = new TracingResponseListener<>(listener, span);
  super.doExecute(action, request, actionFuture);
}
 
开发者ID:opentracing-contrib,项目名称:java-elasticsearch-client,代码行数:14,代码来源:TracingPreBuiltTransportClient.java

示例11: readFrom

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    store = in.readString();
    routing = in.readOptionalString();
    action = Action.values()[in.readVInt()];
    storableElement = in.readNamedWriteable(StorableElement.class);
    validation = in.readOptionalWriteable(FeatureValidation::new);
}
 
开发者ID:o19s,项目名称:elasticsearch-learning-to-rank,代码行数:10,代码来源:FeatureStoreAction.java

示例12: execute

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void execute(
		Action<Request, Response, RequestBuilder> action, Request request,
		ActionListener<Response> listener) {
	// TODO Auto-generated method stub

}
 
开发者ID:winterstein,项目名称:elasticsearch-java-client,代码行数:8,代码来源:DummyClient.java

示例13: doExecute

import org.elasticsearch.action.Action; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public <R extends ActionRequest, T extends ActionResponse, B extends ActionRequestBuilder<R, T, B>>
void doExecute(Action<R, T, B> action, R request, ActionListener<T> listener) {
    HttpAction httpAction = actionMap.get(action);
    if (httpAction == null) {
        throw new IllegalStateException("failed to find http action [" + action + "] to execute");
    }
    try {
        HttpContext httpContext = new HttpContext(httpAction, listener, request);
        httpContext.httpRequest = httpAction.createHttpRequest(url, request);
        ChannelFuture future = bootstrap.connect(new InetSocketAddress(url.getHost(), url.getPort()));
        future.awaitUninterruptibly();
        if (!future.isSuccess()) {
            bootstrap.releaseExternalResources();
            logger.error("can't connect to {}", url);
        } else {
            Channel channel = future.getChannel();
            httpContext.setChannel(channel);
            httpContextMap.put(channel, httpContext);
            channel.getConfig().setConnectTimeoutMillis(settings.getAsInt("http.client.timeout", 5000));
            httpAction.execute(httpContext, listener);
        }
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
}
 
开发者ID:jprante,项目名称:elasticsearch-client-http,代码行数:28,代码来源:HttpClient.java

示例14: execute

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
public <RequestT extends ActionRequest, ResponseT extends ActionResponse,
    RequestBuilderT extends ActionRequestBuilder<RequestT, ResponseT, RequestBuilderT>> ActionFuture<ResponseT> execute(
    Action<RequestT, ResponseT, RequestBuilderT> action, RequestT request)
{
    return null;
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:8,代码来源:ElasticsearchClientImpl.java

示例15: prepareExecute

import org.elasticsearch.action.Action; //导入依赖的package包/类
@Override
public <RequestT extends ActionRequest, ResponseT extends ActionResponse,
    RequestBuilderT extends ActionRequestBuilder<RequestT, ResponseT, RequestBuilderT>> RequestBuilderT prepareExecute(
    Action<RequestT, ResponseT, RequestBuilderT> action)
{
    return null;
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:8,代码来源:ElasticsearchClientImpl.java


注:本文中的org.elasticsearch.action.Action类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。