-
public final class KotlinExtensionsKt
-
-
Method Summary
Modifier and Type Method Description final SearchResponse
searchAsync(RestHighLevelClient $self, RequestOptions requestOptions, Function1<SearchRequest, Unit> block)
Suspend version of search that you can use in a co-routine context. final RestHighLevelClient
create(String host, Integer port, Boolean https, String user, String password, Boolean useSniffer, Integer sniffAfterFailureDelayMillis, Integer sniffIntervalMillis)
Factory method that gives you sane defaults that will allow you to quickly connect to your cluster whether it is in Elastic Cloud that requires authentication or a local cluster. final RestHighLevelClient
RestHighLevelClient(String host, Integer port, Boolean https, String user, String password, Boolean useSniffer, Integer sniffAfterFailureDelayMillis, Integer sniffIntervalMillis)
final <T extends Any> IndexRepository<T>
crudDao(RestHighLevelClient $self, String index, ModelReaderAndWriter<T> modelReaderAndWriter, String type, String readAlias, String writeAlias, Boolean refreshAllowed, RequestOptions defaultRequestOptions)
final <T extends Any> IndexRepository<T>
indexRepository(RestHighLevelClient $self, String index, ModelReaderAndWriter<T> modelReaderAndWriter, String type, String readAlias, String writeAlias, Boolean refreshAllowed, FetchSourceContext fetchSourceContext, RequestOptions defaultRequestOptions)
Create a new Index Repository. final <T extends Any> AsyncIndexRepository<T>
asyncIndexRepository(RestHighLevelClient $self, String index, ModelReaderAndWriter<T> modelReaderAndWriter, String type, String readAlias, String writeAlias, Boolean refreshAllowed, FetchSourceContext fetchSourceContext, RequestOptions defaultRequestOptions)
final <T extends Any> IndexRepository<T>
createIndexRepository(RestHighLevelClient $self, String index, ModelReaderAndWriter<T> modelReaderAndWriter, String type, String readAlias, String writeAlias, Boolean refreshAllowed, FetchSourceContext fetchSourceContext, RequestOptions defaultRequestOptions)
final SearchResponse
search(RestHighLevelClient $self, RequestOptions requestOptions, Function1<SearchRequest, Unit> block)
Search documents in the index. final SearchResponse
scroll(RestHighLevelClient $self, String scrollId, Long ttl, RequestOptions requestOptions)
Get the next page of a scrolling search. final ClearScrollResponse
clearScroll(RestHighLevelClient $self, String scrollIds, RequestOptions requestOptions)
Clear the scroll after you are done. final CreateIndexRequest
source(CreateIndexRequest $self, String json)
final Unit
configure(CreateIndexRequest $self, Boolean generateMetaFields, Boolean pretty, Function1<IndexSettingsAndMappingsDSL, Unit> block)
-
-
Method Detail
-
searchAsync
final SearchResponse searchAsync(RestHighLevelClient $self, RequestOptions requestOptions, Function1<SearchRequest, Unit> block)
Suspend version of search that you can use in a co-routine context. Works the same otherwise.
-
create
final RestHighLevelClient create(String host, Integer port, Boolean https, String user, String password, Boolean useSniffer, Integer sniffAfterFailureDelayMillis, Integer sniffIntervalMillis)
Factory method that gives you sane defaults that will allow you to quickly connect to your cluster whether it is in Elastic Cloud that requires authentication or a local cluster.
If you need basic authentication, simply set user and password to the appropriate values.
If you need https, set https to true.
If you are connecting to a local cluster and don't use a loadbalancer, it is advisable to configure the sniffer.
This enables client side load balancing between the nodes and adds some intelligence to deal with nodes being unresponsive or cluster layout changing. Simply set useSniffer to true. Note, beware that docker internal ips may not be reachable from your client and make sure that the addresses returned by
/_nodes/http
are actually reachable from where your client is running.
-
RestHighLevelClient
@Deprecated(message = "Use the create function", replaceWith = @ReplaceWith(imports = {}, expression = "create(host,port,https,user,password,useSniffer,sniffAfterFailureDelayMillis,sniffIntervalMillis)")) final RestHighLevelClient RestHighLevelClient(String host, Integer port, Boolean https, String user, String password, Boolean useSniffer, Integer sniffAfterFailureDelayMillis, Integer sniffIntervalMillis)
-
crudDao
@Deprecated(message = "Use indexRepository", replaceWith = @ReplaceWith(imports = {}, expression = "RestHighLevelClient.indexRepository(index,type,modelReaderAndWriter,refreshAllowed,readAlias,writeAlias,defaultRequestOptions)")) final <T extends Any> IndexRepository<T> crudDao(RestHighLevelClient $self, String index, ModelReaderAndWriter<T> modelReaderAndWriter, String type, String readAlias, String writeAlias, Boolean refreshAllowed, RequestOptions defaultRequestOptions)
-
indexRepository
final <T extends Any> IndexRepository<T> indexRepository(RestHighLevelClient $self, String index, ModelReaderAndWriter<T> modelReaderAndWriter, String type, String readAlias, String writeAlias, Boolean refreshAllowed, FetchSourceContext fetchSourceContext, RequestOptions defaultRequestOptions)
Create a new Index Repository. If you've used enterprise frameworks, you should be familiar with this pattern.
This abstracts the business of telling the client which index to run against and serializing/deserializing documents in it.
-
asyncIndexRepository
final <T extends Any> AsyncIndexRepository<T> asyncIndexRepository(RestHighLevelClient $self, String index, ModelReaderAndWriter<T> modelReaderAndWriter, String type, String readAlias, String writeAlias, Boolean refreshAllowed, FetchSourceContext fetchSourceContext, RequestOptions defaultRequestOptions)
-
createIndexRepository
final <T extends Any> IndexRepository<T> createIndexRepository(RestHighLevelClient $self, String index, ModelReaderAndWriter<T> modelReaderAndWriter, String type, String readAlias, String writeAlias, Boolean refreshAllowed, FetchSourceContext fetchSourceContext, RequestOptions defaultRequestOptions)
-
search
final SearchResponse search(RestHighLevelClient $self, RequestOptions requestOptions, Function1<SearchRequest, Unit> block)
Search documents in the index. Expects a search block that takes a
SearchRequest
where you specify the query. The search request already has your index. Also see extension functions added inorg.elasticsearch.action.search.SearchRequest
-
scroll
final SearchResponse scroll(RestHighLevelClient $self, String scrollId, Long ttl, RequestOptions requestOptions)
Get the next page of a scrolling search. Note, use the Repository to do scrolling searches and avoid manually doing these requests.
-
clearScroll
final ClearScrollResponse clearScroll(RestHighLevelClient $self, String scrollIds, RequestOptions requestOptions)
Clear the scroll after you are done. If you use the Repository for scrolling searches, this is called for you.
-
-
-
-