// Path: jres-core/src/main/java/com/blacklocus/jres/request/JresJsonRequest.java
// public abstract class JresJsonRequest<REPLY extends JresReply> implements JresRequest<REPLY> {
// 
//     private final Class<REPLY> responseClass;
// 
//     protected JresJsonRequest(Class<REPLY> responseClass) {
//         this.responseClass = responseClass;
//     }
// 
//     @Override
//     public final Class<REPLY> getResponseClass() {
//         return responseClass;
//     }
// }
// 
// Path: jres-core/src/main/java/com/blacklocus/jres/response/search/JresSearchReply.java
// public class JresSearchReply extends JresJsonReply {
// 
//     private Integer took;
// 
//     @JsonProperty("timed_out")
//     private Boolean timedOut;
// 
//     @JsonProperty("_shards")
//     private Shards shards;
// 
//     private Hits hits;
// 
//     private Facets facets;
// 
// 
//     public Integer getTook() {
//         return took;
//     }
// 
//     public Boolean isTimedOut() {
//         return timedOut;
//     }
// 
//     public Shards getShards() {
//         return shards;
//     }
// 
//     public Hits getHits() {
//         return hits;
//     }
// 
//     public Facets getFacets() {
//         return facets;
//     }
// 
//     /**
//      * Shortcut to {@link Hit#getSourceAsType(Class)}
//      */
//     public <T> List<T> getHitsAsType(final Class<T> klass) {
//         return Lists.transform(getHits().getHits(), new Function<Hit, T>() {
//             @Override
//             public T apply(Hit hit) {
//                 return hit.getSourceAsType(klass);
//             }
//         });
//     }
// 
//     /**
//      * Shortcut to {@link Hit#getSourceAsType(TypeReference)}
//      */
//     public <T> List<T> getHitsAsType(final TypeReference<T> typeReference) {
//         return Lists.transform(getHits().getHits(), new Function<Hit, T>() {
//             @Override
//             public T apply(Hit hit) {
//                 return hit.getSourceAsType(typeReference);
//             }
//         });
//     }
// }
// 
// Path: jres-core/src/main/java/com/blacklocus/jres/strings/JresPaths.java
// public class JresPaths {
// 
//     /**
//      * @return fragments each appended with '/' if not present, and concatenated together
//      */
//     public static String slashed(String... fragments) {
//         StringBuilder sb = new StringBuilder();
//         for (String fragment : fragments) {
//             sb.append(StringUtils.isBlank(fragment) || fragment.endsWith("/") ?
//                     (fragment == null ? "" : fragment) :
//                     fragment + "/");
//         }
//         return sb.toString();
//     }
// 
//     /**
//      * @return fragments encoded as valid URI path sections, each appended with '/' if not present. <code>null</code>s
//      * upgraded to empty strings. Appends nothing to blank strings (and nulls). Any leading slashes will be dropped.
//      */
//     public static String slashedPath(String... fragments) {
//         String slashed = slashed(fragments);
//         try {
//             // Encode (anything that needs to be) in the path. Surprisingly this works.
//             String encodedPath = new URI(null, null, slashed, null).getRawPath();
//             // Strip leading slash. Omitting it is slightly more portable where URIs are being constructed.
//             return encodedPath.startsWith("/") ? encodedPath.substring(1) : encodedPath;
//         } catch (URISyntaxException e) {
//             throw new RuntimeException(e);
//         }
//     }
// }


import com.blacklocus.jres.request.JresJsonRequest;
import com.blacklocus.jres.response.search.JresSearchReply;
import com.blacklocus.jres.strings.JresPaths;
import org.apache.http.client.methods.HttpPost;
import javax.annotation.Nullable;
    public JresSearch(JresSearchBody searchBody) {
        this(null, null, searchBody);
    }

    public JresSearch(@Nullable String index) {
        this(index, null, new JresSearchBody());
    }

    public JresSearch(@Nullable String index, @Nullable String type) {
        this(index, type, new JresSearchBody());
    }

    public JresSearch(@Nullable String index, @Nullable String type, JresSearchBody searchBody) {
        this(index, type, (Object) searchBody);
    }

    public JresSearch(@Nullable String index, @Nullable String type, Object searchBody) {
        super(JresSearchReply.class);
        this.searchBody = searchBody;
        this.index = index;
        this.type = type;
    }

    @Override
    public String getHttpMethod() {
        return HttpPost.METHOD_NAME;
    }

    @Override
    public String getPath() {
// Path: jres-core/src/main/java/com/blacklocus/jres/request/JresJsonRequest.java
// public abstract class JresJsonRequest<REPLY extends JresReply> implements JresRequest<REPLY> {
// 
//     private final Class<REPLY> responseClass;
// 
//     protected JresJsonRequest(Class<REPLY> responseClass) {
//         this.responseClass = responseClass;
//     }
// 
//     @Override
//     public final Class<REPLY> getResponseClass() {
//         return responseClass;
//     }
// }
// 
// Path: jres-core/src/main/java/com/blacklocus/jres/response/search/JresSearchReply.java
// public class JresSearchReply extends JresJsonReply {
// 
//     private Integer took;
// 
//     @JsonProperty("timed_out")
//     private Boolean timedOut;
// 
//     @JsonProperty("_shards")
//     private Shards shards;
// 
//     private Hits hits;
// 
//     private Facets facets;
// 
// 
//     public Integer getTook() {
//         return took;
//     }
// 
//     public Boolean isTimedOut() {
//         return timedOut;
//     }
// 
//     public Shards getShards() {
//         return shards;
//     }
// 
//     public Hits getHits() {
//         return hits;
//     }
// 
//     public Facets getFacets() {
//         return facets;
//     }
// 
//     /**
//      * Shortcut to {@link Hit#getSourceAsType(Class)}
//      */
//     public <T> List<T> getHitsAsType(final Class<T> klass) {
//         return Lists.transform(getHits().getHits(), new Function<Hit, T>() {
//             @Override
//             public T apply(Hit hit) {
//                 return hit.getSourceAsType(klass);
//             }
//         });
//     }
// 
//     /**
//      * Shortcut to {@link Hit#getSourceAsType(TypeReference)}
//      */
//     public <T> List<T> getHitsAsType(final TypeReference<T> typeReference) {
//         return Lists.transform(getHits().getHits(), new Function<Hit, T>() {
//             @Override
//             public T apply(Hit hit) {
//                 return hit.getSourceAsType(typeReference);
//             }
//         });
//     }
// }
// 
// Path: jres-core/src/main/java/com/blacklocus/jres/strings/JresPaths.java
// public class JresPaths {
// 
//     /**
//      * @return fragments each appended with '/' if not present, and concatenated together
//      */
//     public static String slashed(String... fragments) {
//         StringBuilder sb = new StringBuilder();
//         for (String fragment : fragments) {
//             sb.append(StringUtils.isBlank(fragment) || fragment.endsWith("/") ?
//                     (fragment == null ? "" : fragment) :
//                     fragment + "/");
//         }
//         return sb.toString();
//     }
// 
//     /**
//      * @return fragments encoded as valid URI path sections, each appended with '/' if not present. <code>null</code>s
//      * upgraded to empty strings. Appends nothing to blank strings (and nulls). Any leading slashes will be dropped.
//      */
//     public static String slashedPath(String... fragments) {
//         String slashed = slashed(fragments);
//         try {
//             // Encode (anything that needs to be) in the path. Surprisingly this works.
//             String encodedPath = new URI(null, null, slashed, null).getRawPath();
//             // Strip leading slash. Omitting it is slightly more portable where URIs are being constructed.
//             return encodedPath.startsWith("/") ? encodedPath.substring(1) : encodedPath;
//         } catch (URISyntaxException e) {
//             throw new RuntimeException(e);
//         }
//     }
// }


// Path: jres-core/src/main/java/com/blacklocus/jres/request/search/JresSearch.java
import com.blacklocus.jres.request.JresJsonRequest;
import com.blacklocus.jres.response.search.JresSearchReply;
import com.blacklocus.jres.strings.JresPaths;
import org.apache.http.client.methods.HttpPost;
import javax.annotation.Nullable;

    public JresSearch(JresSearchBody searchBody) {
        this(null, null, searchBody);
    }

    public JresSearch(@Nullable String index) {
        this(index, null, new JresSearchBody());
    }

    public JresSearch(@Nullable String index, @Nullable String type) {
        this(index, type, new JresSearchBody());
    }

    public JresSearch(@Nullable String index, @Nullable String type, JresSearchBody searchBody) {
        this(index, type, (Object) searchBody);
    }

    public JresSearch(@Nullable String index, @Nullable String type, Object searchBody) {
        super(JresSearchReply.class);
        this.searchBody = searchBody;
        this.index = index;
        this.type = type;
    }

    @Override
    public String getHttpMethod() {
        return HttpPost.METHOD_NAME;
    }

    @Override
    public String getPath() {
        return JresPaths.slashedPath(index) + JresPaths.slashedPath(type) + "_search";