mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-09 06:25:07 +00:00
add percolate api to groovy client
This commit is contained in:
parent
b888684ff6
commit
2bc2b3f4e2
@ -50,7 +50,7 @@ public class PercolateRequest extends SingleCustomOperationRequest {
|
|||||||
private int sourceLength;
|
private int sourceLength;
|
||||||
private boolean sourceUnsafe;
|
private boolean sourceUnsafe;
|
||||||
|
|
||||||
PercolateRequest() {
|
public PercolateRequest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ import org.elasticsearch.action.get.GetResponse
|
|||||||
import org.elasticsearch.action.index.IndexRequest
|
import org.elasticsearch.action.index.IndexRequest
|
||||||
import org.elasticsearch.action.index.IndexResponse
|
import org.elasticsearch.action.index.IndexResponse
|
||||||
import org.elasticsearch.action.mlt.MoreLikeThisRequest
|
import org.elasticsearch.action.mlt.MoreLikeThisRequest
|
||||||
|
import org.elasticsearch.action.percolate.PercolateRequest
|
||||||
|
import org.elasticsearch.action.percolate.PercolateResponse
|
||||||
import org.elasticsearch.action.search.SearchRequest
|
import org.elasticsearch.action.search.SearchRequest
|
||||||
import org.elasticsearch.action.search.SearchResponse
|
import org.elasticsearch.action.search.SearchResponse
|
||||||
import org.elasticsearch.client.Client
|
import org.elasticsearch.client.Client
|
||||||
@ -40,6 +42,7 @@ import org.elasticsearch.client.action.delete.DeleteRequestBuilder
|
|||||||
import org.elasticsearch.client.action.deletebyquery.DeleteByQueryRequestBuilder
|
import org.elasticsearch.client.action.deletebyquery.DeleteByQueryRequestBuilder
|
||||||
import org.elasticsearch.client.action.get.GetRequestBuilder
|
import org.elasticsearch.client.action.get.GetRequestBuilder
|
||||||
import org.elasticsearch.client.action.index.IndexRequestBuilder
|
import org.elasticsearch.client.action.index.IndexRequestBuilder
|
||||||
|
import org.elasticsearch.client.action.percolate.PercolateRequestBuilder
|
||||||
import org.elasticsearch.client.action.search.SearchRequestBuilder
|
import org.elasticsearch.client.action.search.SearchRequestBuilder
|
||||||
import org.elasticsearch.client.action.support.BaseRequestBuilder
|
import org.elasticsearch.client.action.support.BaseRequestBuilder
|
||||||
import org.elasticsearch.client.internal.InternalClient
|
import org.elasticsearch.client.internal.InternalClient
|
||||||
@ -146,6 +149,19 @@ class GClient {
|
|||||||
MoreLikeThisRequest.metaClass.searchSource = {Closure c ->
|
MoreLikeThisRequest.metaClass.searchSource = {Closure c ->
|
||||||
delegate.searchSource(new GXContentBuilder().buildAsBytes(c, contentType))
|
delegate.searchSource(new GXContentBuilder().buildAsBytes(c, contentType))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PercolateRequest.metaClass.setSource = {Closure c ->
|
||||||
|
delegate.source(new GXContentBuilder().buildAsBytes(c, indexContentType))
|
||||||
|
}
|
||||||
|
PercolateRequest.metaClass.source = {Closure c ->
|
||||||
|
delegate.source(new GXContentBuilder().buildAsBytes(c, indexContentType))
|
||||||
|
}
|
||||||
|
PercolateRequestBuilder.metaClass.setSource = {Closure c ->
|
||||||
|
delegate.setSource(new GXContentBuilder().buildAsBytes(c, indexContentType))
|
||||||
|
}
|
||||||
|
PercolateRequestBuilder.metaClass.source = {Closure c ->
|
||||||
|
delegate.setSource(new GXContentBuilder().buildAsBytes(c, indexContentType))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XContentType contentType = XContentType.SMILE
|
public static XContentType contentType = XContentType.SMILE
|
||||||
@ -303,6 +319,24 @@ class GClient {
|
|||||||
client.search(request, listener)
|
client.search(request, listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PercolateRequestBuilder preparePercolate(String index, String type) {
|
||||||
|
return client.preparePercolate(index, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
GActionFuture<PercolateResponse> percolate(Closure c) {
|
||||||
|
PercolateRequest request = new PercolateRequest();
|
||||||
|
c.resolveStrategy = resolveStrategy
|
||||||
|
c.setDelegate request
|
||||||
|
c.call()
|
||||||
|
percolate(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
GActionFuture<PercolateResponse> percolate(PercolateRequest request) {
|
||||||
|
GActionFuture<PercolateResponse> future = new GActionFuture<PercolateResponse>(internalClient.threadPool(), request)
|
||||||
|
client.percolate(request, future)
|
||||||
|
return future
|
||||||
|
}
|
||||||
|
|
||||||
GActionFuture<SearchResponse> moreLikeThis(Closure c) {
|
GActionFuture<SearchResponse> moreLikeThis(Closure c) {
|
||||||
MoreLikeThisRequest request = new MoreLikeThisRequest()
|
MoreLikeThisRequest request = new MoreLikeThisRequest()
|
||||||
c.resolveStrategy = resolveStrategy
|
c.resolveStrategy = resolveStrategy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user