Package org.graylog2.restclient.models

Examples of org.graylog2.restclient.models.UniversalSearch


    @Test
    public void testBuildTarget() throws Exception {
        setupNodes(AddressNodeId.create("http://horst:12900"));

        // we only have one node configured here
        final Node node = serverNodes.any();
        api.setHttpClient(client);

        final URL url = api.get(EmptyResponse.class).path("/some/resource").session("foo").node(node).prepareUrl(node);
        final URL queryParamWithPlus = api.get(EmptyResponse.class).path("/some/resource").queryParam("query", " (.+)").node(node).unauthenticated().prepareUrl(node);
View Full Code Here


    @Test
    public void testSingleExecute() throws Exception {
        setupNodes(AddressNodeId.create("http://horst:12900"));

        // we only have one node configured here
        final Node node = serverNodes.any();
        api.setHttpClient(client);

        final ApiRequestBuilder<EmptyResponse> requestBuilder =
                api.get(EmptyResponse.class)
                        .path("/some/resource")
View Full Code Here

    public void testParallelExecution() throws Exception {
        setupNodes(AddressNodeId.create("http://horst1:12900"), AddressNodeId.create("http://horst2:12900"));

        final Collection<Node> nodes = serverNodes.all();
        final Iterator<Node> it = nodes.iterator();
        Node node1 = it.next();
        Node node2 = it.next();
        api.setHttpClient(client);

        final ApiRequestBuilder<EmptyResponse> requestBuilder = api.get(EmptyResponse.class).path("/some/resource");
        final URL url1 = requestBuilder.prepareUrl(node1);
        final URL url2 = requestBuilder.prepareUrl(node2);
View Full Code Here

        final ArrayList<Node> nodes = Lists.newArrayList();
        for (AddressNodeId n : nodeDesc) {
            NodeSummaryResponse r = new NodeSummaryResponse();
            r.transportAddress = n.address;
            r.id = n.nodeId;
            final Node node = factory.fromSummaryResponse(r);
            node.touch();
            nodes.add(node);
        }
        serverNodes.put(nodes);
    }
View Full Code Here

public class SearchRouteHelper {

    public static Call getRoute(UniversalSearch search,
                                Http.Request request,
                                int page) {
        SearchSort order = search.getOrder();
        return getRoute(search, request, page, order.getField(), order.getDirection().toString().toLowerCase());
    }
View Full Code Here

            case EMAIL_TRANSPORT_FAILED:
                return new EmailTransportFailedNotification(notification);
            case STREAM_PROCESSING_DISABLED:
                String streamTitle;
                try {
                    final Stream stream = streamService.get(notification.getDetail("stream_id").toString());
                    streamTitle = stream.getTitle();
                } catch (APIException | IOException e) {
                    streamTitle = "(Stream title unavailable)";
                }
                int faultCount = (int) notification.getDetail("fault_count");
                return new StreamProcessingDisabledNotification(notification, streamTitle, faultCount);
View Full Code Here

        if (streamId != null && !streamId.isEmpty()) {
            filter = "streams:" + streamId;
        }

        try {
            UniversalSearch search = searchFactory.queryWithRangeAndFilter(q, timerange, filter);
            FieldStatsResponse stats = search.fieldStats(field);

            Map<String, Object> result = Maps.newHashMap();
            result.put("count", stats.count);
            result.put("sum", stats.sum);
            result.put("mean", stats.mean);
View Full Code Here

        if (streamId != null && !streamId.isEmpty()) {
            filter = "streams:" + streamId;
        }

        try {
            UniversalSearch search = searchFactory.queryWithRangeAndFilter(q, timerange, filter);
            FieldTermsResponse terms = search.fieldTerms(field);

            Map<String, Object> result = Maps.newHashMap();
            result.put("total", terms.total);
            result.put("missing", terms.missing);
            result.put("time", terms.time);
View Full Code Here

        if (streamId != null && !streamId.isEmpty()) {
            filter = "streams:" + streamId;
        }

        try {
            UniversalSearch search = searchFactory.queryWithRangeAndFilter(q, timerange, filter);
            FieldHistogramResponse histo = search.fieldHistogram(field, interval);

            Map<String, Object> result = Maps.newHashMap();
            AbsoluteRange boundaries = histo.getHistogramBoundaries();
            result.put("time", histo.time);
            result.put("interval", histo.interval);
View Full Code Here

        if (streamId != null && !streamId.isEmpty()) {
            filter = "streams:" + streamId;
        }

        try {
            UniversalSearch search = searchFactory.queryWithRangeAndFilter(q, timerange, filter);
            DateHistogramResult histogram = search.dateHistogram(interval);
            List<Map<String, Long>> results = formatHistogramResults(histogram, maxDataPoints, relative == 0);

            Map<String, Object> result = Maps.newHashMap();
            AbsoluteRange boundaries = histogram.getHistogramBoundaries();
            result.put("time", histogram.getTookMs());
View Full Code Here

TOP

Related Classes of org.graylog2.restclient.models.UniversalSearch

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.