[ 
https://issues.apache.org/jira/browse/METRON-1022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16077208#comment-16077208
 ] 

ASF GitHub Bot commented on METRON-1022:
----------------------------------------

Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/636#discussion_r126018390
  
    --- Diff: 
metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/ElasticsearchServiceImpl.java
 ---
    @@ -0,0  1,74 @@
     /**
      * Licensed to the Apache Software Foundation (ASF) under one
      * or more contributor license agreements.  See the NOTICE file
      * distributed with this work for additional information
      * regarding copyright ownership.  The ASF licenses this file
      * to you under the Apache License, Version 2.0 (the
      * "License"); you may not use this file except in compliance
      * with the License.  You may obtain a copy of the License at
      *
      *     http://www.apache.org/licenses/LICENSE-2.0
      *
      * Unless required by applicable law or agreed to in writing, software
      * distributed under the License is distributed on an "AS IS" BASIS,
      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      * See the License for the specific language governing permissions and
      * limitations under the License.
      */
     package org.apache.metron.rest.service.impl;
     
     import org.apache.metron.rest.RestException;
     import org.apache.metron.rest.model.SearchRequest;
     import org.apache.metron.rest.model.SearchResponse;
     import org.apache.metron.rest.model.SearchResult;
     import org.apache.metron.rest.model.SortField;
     import org.apache.metron.rest.service.SearchService;
     import org.elasticsearch.client.transport.TransportClient;
     import org.elasticsearch.index.query.QueryStringQueryBuilder;
     import org.elasticsearch.search.builder.SearchSourceBuilder;
     import org.elasticsearch.search.sort.FieldSortBuilder;
     import org.elasticsearch.search.sort.SortOrder;
     import org.springframework.beans.factory.annotation.Autowired;
     import org.springframework.stereotype.Service;
     
     import java.util.Arrays;
     import java.util.stream.Collectors;
     
     @Service
     public class ElasticsearchServiceImpl implements SearchService {
     
       private TransportClient client;
     
       @Autowired
       public ElasticsearchServiceImpl(TransportClient client) {
         this.client = client;
       }
     
       @Override
       public SearchResponse search(SearchRequest searchRequest) throws 
RestException {
         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder()
                 .size(searchRequest.getSize())
                 .from(searchRequest.getFrom())
                 .query(new QueryStringQueryBuilder(searchRequest.getQuery()))
                 .fetchSource(true)
                 .trackScores(true);
         for(SortField sortField: searchRequest.getSort()) {
           FieldSortBuilder fieldSortBuilder = new 
FieldSortBuilder(sortField.getField());
           fieldSortBuilder.order(sortField.getSortOrder() == 
org.apache.metron.rest.model.SortOrder.DESC ? SortOrder.DESC : SortOrder.ASC);
           searchSourceBuilder = searchSourceBuilder.sort(fieldSortBuilder);
         }
    --- End diff --
    
    Is there a limit to how much can be passed back here?  Can the user run a 
request that returns too much data?
    Do we need paging?  Max return count?


> Elasticsearch REST endpoint
> ---------------------------
>
>                 Key: METRON-1022
>                 URL: https://issues.apache.org/jira/browse/METRON-1022
>             Project: Metron
>          Issue Type: New Feature
>            Reporter: Ryan Merriman
>
> We need a "search" endpoint that will allow basic lucene-style searches with 
> sorting and pagination options.  This endpoint should have a light 
> abstraction on top to make it simpler to consume and possibly allow different 
> search engines to be used in the future.  



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to