// Path: src/main/java/org/xbib/elasticsearch/action/search/helper/BasicGetRequest.java
// public class BasicGetRequest {
// 
//     private final ESLogger logger = ESLoggerFactory.getLogger(BasicGetRequest.class.getName());
// 
//     private GetRequestBuilder getRequestBuilder;
// 
//     private String index;
// 
//     private String type;
// 
//     private String id;
// 
//     public BasicGetRequest newRequest(GetRequestBuilder getRequestBuilder) {
//         this.getRequestBuilder = getRequestBuilder;
//         return this;
//     }
// 
//     public GetRequestBuilder getRequestBuilder() {
//         return getRequestBuilder;
//     }
// 
//     public BasicGetRequest index(String index) {
//         if (index != null && !"*".equals(index)) {
//             this.index = index;
//         }
//         return this;
//     }
// 
//     public String index() {
//         return index;
//     }
// 
//     public BasicGetRequest type(String type) {
//         if (type != null && !"*".equals(type)) {
//             this.type = type;
//         }
//         return this;
//     }
// 
//     public String type() {
//         return type;
//     }
// 
//     public BasicGetRequest id(String id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String id() {
//         return id;
//     }
// 
//     public BasicGetResponse execute() throws IOException {
//         BasicGetResponse response = new BasicGetResponse();
//         if (getRequestBuilder == null) {
//             return response;
//         }
//         logger.info(" get request: {}/{}/{}",
//                 getRequestBuilder.request().index(),
//                 getRequestBuilder.request().type(),
//                 getRequestBuilder.request().id());
//         getRequestBuilder
//                 .setIndex(index)
//                 .setType(type)
//                 .setId(id);
//         long t0 = System.currentTimeMillis();
//         response.setResponse(getRequestBuilder.execute().actionGet());
//         long t1 = System.currentTimeMillis();
//         logger.info(" get request complete: {}/{}/{} [{}ms] {}",
//                 getRequestBuilder.request().index(),
//                 getRequestBuilder.request().type(),
//                 getRequestBuilder.request().id(),
//                 (t1 - t0), response.exists());
//         return response;
//     }
// 
// }


import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings;
import org.xbib.elasticsearch.action.search.helper.BasicGetRequest;
import org.xbib.elasticsearch.action.search.helper.BasicSearchRequest;
import java.io.IOException;
import java.util.Map;
/*
 * Copyright (C) 2015 Jörg Prante
 *
 * Licensed 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.xbib.elasticsearch.helper.client;



/**
 * Search support
 */
public interface Search {

    Search init(Settings settings) throws IOException;

    Search init(Map<String, String> settings) throws IOException;

    /**
     * Return the Elasticsearch client
     *
     * @return the client
     */
    ElasticsearchClient client();

    /**
     * Get index
     *
     * @return the index
     */
    String getIndex();

    /**
     * Set index
     *
     * @param index index
     * @return this search
     */
    Search setIndex(String index);

    /**
     * Create new search request
     *
     * @return this search request
     */
    BasicSearchRequest newSearchRequest();

    /**
     * Create new get request
     *
     * @return this search request
     */
// Path: src/main/java/org/xbib/elasticsearch/action/search/helper/BasicGetRequest.java
// public class BasicGetRequest {
// 
//     private final ESLogger logger = ESLoggerFactory.getLogger(BasicGetRequest.class.getName());
// 
//     private GetRequestBuilder getRequestBuilder;
// 
//     private String index;
// 
//     private String type;
// 
//     private String id;
// 
//     public BasicGetRequest newRequest(GetRequestBuilder getRequestBuilder) {
//         this.getRequestBuilder = getRequestBuilder;
//         return this;
//     }
// 
//     public GetRequestBuilder getRequestBuilder() {
//         return getRequestBuilder;
//     }
// 
//     public BasicGetRequest index(String index) {
//         if (index != null && !"*".equals(index)) {
//             this.index = index;
//         }
//         return this;
//     }
// 
//     public String index() {
//         return index;
//     }
// 
//     public BasicGetRequest type(String type) {
//         if (type != null && !"*".equals(type)) {
//             this.type = type;
//         }
//         return this;
//     }
// 
//     public String type() {
//         return type;
//     }
// 
//     public BasicGetRequest id(String id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String id() {
//         return id;
//     }
// 
//     public BasicGetResponse execute() throws IOException {
//         BasicGetResponse response = new BasicGetResponse();
//         if (getRequestBuilder == null) {
//             return response;
//         }
//         logger.info(" get request: {}/{}/{}",
//                 getRequestBuilder.request().index(),
//                 getRequestBuilder.request().type(),
//                 getRequestBuilder.request().id());
//         getRequestBuilder
//                 .setIndex(index)
//                 .setType(type)
//                 .setId(id);
//         long t0 = System.currentTimeMillis();
//         response.setResponse(getRequestBuilder.execute().actionGet());
//         long t1 = System.currentTimeMillis();
//         logger.info(" get request complete: {}/{}/{} [{}ms] {}",
//                 getRequestBuilder.request().index(),
//                 getRequestBuilder.request().type(),
//                 getRequestBuilder.request().id(),
//                 (t1 - t0), response.exists());
//         return response;
//     }
// 
// }


// Path: src/main/java/org/xbib/elasticsearch/helper/client/Search.java
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings;
import org.xbib.elasticsearch.action.search.helper.BasicGetRequest;
import org.xbib.elasticsearch.action.search.helper.BasicSearchRequest;
import java.io.IOException;
import java.util.Map;

/*
 * Copyright (C) 2015 Jörg Prante
 *
 * Licensed 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.xbib.elasticsearch.helper.client;



/**
 * Search support
 */
public interface Search {

    Search init(Settings settings) throws IOException;

    Search init(Map<String, String> settings) throws IOException;

    /**
     * Return the Elasticsearch client
     *
     * @return the client
     */
    ElasticsearchClient client();

    /**
     * Get index
     *
     * @return the index
     */
    String getIndex();

    /**
     * Set index
     *
     * @param index index
     * @return this search
     */
    Search setIndex(String index);

    /**
     * Create new search request
     *
     * @return this search request
     */
    BasicSearchRequest newSearchRequest();

    /**
     * Create new get request
     *
     * @return this search request
     */
    BasicGetRequest newGetRequest();