Package org.elasticsearch.action.get

Examples of org.elasticsearch.action.get.GetRequest


     * @param index The index to get the JSON source from
     * @return The get request
     * @see org.elasticsearch.client.Client#get(org.elasticsearch.action.get.GetRequest)
     */
    public static GetRequest getRequest(String index) {
        return new GetRequest(index);
    }
View Full Code Here


        super(settings, client);
        controller.registerHandler(GET, "/{index}/{type}/{id}", this);
    }

    @Override public void handleRequest(final RestRequest request, final RestChannel channel) {
        final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
        // no need to have a threaded listener since we just send back a response
        getRequest.listenerThreaded(false);
        // if we have a local operation, execute it on a thread since we don't spawn
        getRequest.operationThreaded(true);
        getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
        getRequest.routing(request.param("routing"));
        getRequest.preference(request.param("preference"));
        getRequest.realtime(request.paramAsBoolean("realtime", null));

        String sField = request.param("fields");
        if (sField != null) {
            String[] sFields = Strings.splitStringByCommaToArray(sField);
            if (sFields != null) {
                getRequest.fields(sFields);
            }
        }


        client.get(getRequest, new ActionListener<GetResponse>() {
View Full Code Here

* @author kimchy (shay.banon)
*/
public class GetRequestBuilder extends BaseRequestBuilder<GetRequest, GetResponse> {

    public GetRequestBuilder(Client client, @Nullable String index) {
        super(client, new GetRequest(index));
    }
View Full Code Here

            Collections.addAll(getFields, request.fields());
        }
        // add the source, in case we need to parse it to get fields
        getFields.add(SourceFieldMapper.NAME);

        GetRequest getRequest = getRequest(concreteIndex)
                .fields(getFields.toArray(new String[getFields.size()]))
                .type(request.type())
                .id(request.id())
                .listenerThreaded(true)
                .operationThreaded(true);
View Full Code Here

*/
@SuppressWarnings("unused")
public class GetRequestBuilder<JsonInput, JsonOutput> extends AbstractRequestBuilderToXContent<GetRequest, GetResponse, JsonInput, JsonOutput> {

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

      final String id = SecurityUtil.getId(request);

      try {
        final GetResponse res = securityService
            .getClient()
            .get(new GetRequest(SecurityUtil.getIndices(request)
                .get(0), SecurityUtil.getTypes(request).get(0),
                id)).actionGet();

        log.debug("document with id found: " + res.getId());
View Full Code Here

        // todo add first-level caching and cycle ref checking
        String indexName = elasticSearchContextHolder.getMappingContext(domainClass).getIndexName();
        String name = elasticSearchContextHolder.getMappingContext(domainClass).getElasticTypeName();
        // A property value is expected to be a map in the form [id:ident]
        Object id = data.get("id");
        GetResponse response = elasticSearchClient.get(new GetRequest(indexName)
                .operationThreaded(false)
                .type(name)
                .id(typeConverter.convertIfNecessary(id, String.class)))
                .actionGet();
        return unmarshallDomain(domainClass, response.getId(), response.getSourceAsMap(), unmarshallingContext);
View Full Code Here

            } catch (Exception e) {
                throw new ElasticsearchImageProcessException("Failed to parse image", e);
            }
        } else if (lookupIndex != null && lookupType != null && lookupId != null && lookupPath != null) {
            String lookupFieldName = lookupPath + "." + featureEnum.name();
            GetResponse getResponse = client.get(new GetRequest(lookupIndex, lookupType, lookupId).preference("_local").routing(lookupRouting).fields(lookupFieldName).realtime(false)).actionGet();
            if (getResponse.isExists()) {
                GetField getField = getResponse.getField(lookupFieldName);
                if (getField != null) {
                    BytesReference bytesReference = (BytesReference) getField.getValue();
                    try {
View Full Code Here

            throw new ElasticsearchException(e.getMessage(), e.getCause());
        }
    }

    TermsFilterValue buildTermsFilterValue(TermsLookup lookup) {
        GetResponse getResponse = client.get(new GetRequest(lookup.getIndex(), lookup.getType(), lookup.getId()).preference("_local").routing(lookup.getRouting())).actionGet();
        if (!getResponse.isExists()) {
            return NO_TERMS;
        }
        List<Object> values = XContentMapValues.extractRawValues(lookup.getPath(), getResponse.getSourceAsMap());
        if (values.isEmpty()) {
View Full Code Here

     * @param index The index to get the JSON source from
     * @return The get request
     * @see org.elasticsearch.client.Client#get(org.elasticsearch.action.get.GetRequest)
     */
    public static GetRequest getRequest(String index) {
        return new GetRequest(index);
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.get.GetRequest

Copyright © 2018 www.massapicom. 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.