Package-level declarations

Types

Link copied to clipboard
@Serializable
data class AcknowledgedResponse(val acknowledged: Boolean)
Link copied to clipboard

Use this co routine scope to control affinity to a particular host. Ktor client may attempt to pipeline/reuse connections depending on how you set that up.

Link copied to clipboard
typealias Aggregations = JsonObject
Link copied to clipboard
class AliasAction : JsonDsl
Link copied to clipboard
@Serializable
data class AliasResponse(val aliases: Map<String, JsonObject>)
Link copied to clipboard
class AliasUpdateRequest : JsonDsl

DSL for configuring the update aliases request. The request is a list of actions (add, remove, remove_index). Each action is configured with an AliasAction that specifies the affected indices, aliases, etc.

Link copied to clipboard
class AnalyzeRequest : JsonDsl
Link copied to clipboard
@Serializable
data class AnalyzeResponse(val tokens: List<AnalyzeToken>)
Link copied to clipboard
@Serializable
data class AnalyzeToken(val token: String, val startOffset: Int, val endOffset: Int, val type: String, val position: Int)
Link copied to clipboard
class Bucket<T>(val aggregations: Aggregations, deserializationStrategy: DeserializationStrategy<T>, json: Json = DEFAULT_JSON)
Link copied to clipboard
Link copied to clipboard
class BulkException(val bulkResponse: BulkResponse) : Exception
Link copied to clipboard

Use this to deal with item responses and failures; or bulk request errors. By default, the callback is null.

Link copied to clipboard
@Serializable
data class BulkResponse(val took: Long, val errors: Boolean, val items: List<JsonObject>)
Link copied to clipboard
interface BulkSession
Link copied to clipboard
@Serializable
data class ClusterHealthResponse(val clusterName: String, val status: ClusterStatus, val timedOut: Boolean)
Link copied to clipboard
@Serializable
enum ClusterStatus : Enum<ClusterStatus>
Link copied to clipboard
class ComponentTemplate : JsonDsl
Link copied to clipboard
@Serializable
data class CountResponse(val count: Long, val shards: Shards)
Link copied to clipboard
@Serializable
data class CreatePointInTimeResponse(val id: String)
Link copied to clipboard
@Serializable
data class DateHistogramAggregationResult(val buckets: List<JsonObject>) : BucketAggregationResult<DateHistogramBucket>
Link copied to clipboard
@Serializable
data class DateHistogramBucket(val key: Long, val keyAsString: String, val docCount: Long)
Link copied to clipboard
@Serializable
data class DateRangesAggregationResult(val buckets: List<JsonObject>) : BucketAggregationResult<DateRangesBucket>
Link copied to clipboard
@Serializable
data class DateRangesBucket(val key: String, val docCount: Long, val from: Double?, val fromAsString: String?, val to: Double?, val toAsString: String?)
Link copied to clipboard
@Serializable
data class DeleteByQueryResponse(val took: Long, val timedOut: Boolean, val total: Long, val deleted: Long, val batches: Long, val versionConflicts: Long, val noops: Long, val retries: DeleteByQueryResponse.Retries, val requestsPerSecond: Double, val throttledUntilMillis: Long, val failures: List<JsonObject>? = null)
Link copied to clipboard
@Serializable
data class DocumentIndexResponse(val index: String, val type: String?, val id: String, val version: Long, val result: String, val shards: Shards, val seqNo: Long, val primaryTerm: Long, val source: JsonObject? = null) : SourceInformation
Link copied to clipboard
@Serializable
data class DocumentUpdateResponse(val index: String, val type: String?, val id: String, val version: Long, val result: String, val shards: Shards, val seqNo: Long, val primaryTerm: Long, val get: DocumentUpdateResponse.UpdatedSourceInformation? = null)
Link copied to clipboard
@Serializable
data class DoubleValueAggregationResult(val value: Double, val valueAsString: String?)
Link copied to clipboard
Link copied to clipboard
@Serializable
data class ExtendedStatsBucketResult(val count: Int = 0, val min: Double = 0.0, val max: Double = 0.0, val avg: Double = 0.0, val sum: Double = 0.0, val sumOfSquares: Double = 0.0, val variance: Double = 0.0, val variancePopulation: Double = 0.0, val varianceSampling: Double = 0.0, val stdDeviation: Double = 0.0, val stdDeviationPopulation: Double = 0.0, val stdDeviationSampling: Double = 0.0, val stdDeviationBounds: ExtendedStatsBucketResult.Bounds = Bounds())
Link copied to clipboard
@Serializable
data class FilterAggregationResult(val docCount: Long)
Link copied to clipboard
data class FilterBucket(val name: String, val docCount: Long, val bucket: JsonObject)
Link copied to clipboard
@Serializable
data class FiltersAggregationResult(val buckets: JsonObject)
Link copied to clipboard
@Serializable
data class GeoCentroidResult(val location: GeoCentroidResult.Point, val count: Long)
Link copied to clipboard
@Serializable
data class GeoTileGridBucket(val key: String, val docCount: Long)
Link copied to clipboard
@Serializable
data class GeoTileGridResult(val buckets: List<JsonObject>) : BucketAggregationResult<GeoTileGridBucket>
Link copied to clipboard
@Serializable
data class GetDocumentResponse(val index: String, val type: String?, val id: String, val version: Long?, val source: JsonObject?, val seqNo: Long?, val primaryTerm: Long?, val found: Boolean, val routing: String? = null, val fields: JsonObject? = null) : SourceInformation
Link copied to clipboard
@Serializable
class HitsContainer(val hits: SearchResponse.Hits)
Link copied to clipboard
data class HttpMethod(val value: String)
Link copied to clipboard
class ILMActions : JsonDsl
Link copied to clipboard
class ILMConfiguration : JsonDsl
Link copied to clipboard
class ILMPhaseConfiguration : JsonDsl
Link copied to clipboard
class IMLPhases : JsonDsl
Link copied to clipboard
class IMLPolicy : JsonDsl
Link copied to clipboard
@Serializable
data class IndexCreateResponse(val acknowledged: Boolean, val shardsAcknowledged: Boolean, val index: String)
Link copied to clipboard
interface IndexProvider
Link copied to clipboard
class IndexTemplate : JsonDsl
Link copied to clipboard
class KtorRestClient(nodes: Node = arrayOf( Node( "localhost", 9200 ) ), https: Boolean = false, user: String? = null, password: String? = null, logging: Boolean = false, nodeSelector: NodeSelector = RoundRobinNodeSelector(nodes), elasticApiKey: String? = null, client: HttpClient = defaultKtorHttpClient( logging = logging, user = user, password = password, elasticApiKey = elasticApiKey ) { defaultInit(logging, user, password, elasticApiKey) }) : RestClient, Closeable

Ktor-client implementation of the RestClient.

Link copied to clipboard
@Serializable
data class LongValueAggregationResult(val value: Long, val valueAsString: String?)
Link copied to clipboard
typealias MatchedQueries = JsonElement
Link copied to clipboard
class MGetRequest : JsonDsl
Link copied to clipboard
@Serializable
data class MGetResponse(val docs: List<GetDocumentResponse>)
Link copied to clipboard
class MsearchHeader : JsonDsl
Link copied to clipboard
Link copied to clipboard
@Serializable
data class MultiSearchResponse(val took: Long, val responses: List<SearchResponse>)
Link copied to clipboard
data class Node(val host: String, val port: Int?)
Link copied to clipboard
interface NodeSelector
Link copied to clipboard
Link copied to clipboard
@Serializable
data class RangesAggregationResult(val buckets: List<JsonObject>) : BucketAggregationResult<RangesBucket>
Link copied to clipboard
@Serializable
data class RangesBucket(val key: String, val docCount: Long, val from: Double?, val to: Double?)
Link copied to clipboard
Link copied to clipboard
@Serializable
data class ReindexResponse(val took: Int, val timedOut: Boolean, val total: Int, val updated: Int, val created: Int, val deleted: Int, val batches: Int, val versionConflicts: Int, val noops: Int, val retries: ReindexRetries, val throttledMillis: Int, val requestsPerSecond: Double, val throttledUntilMillis: Int, val failures: List<String>)
Link copied to clipboard
@Serializable
data class ReindexRetries(val bulk: Int, val search: Int)
Link copied to clipboard
interface RestClient

Minimalistic abstraction that should allow for different clients.

Link copied to clipboard
class RestException(val response: RestResponse) : Exception
Link copied to clipboard
sealed class RestResponse
Link copied to clipboard
Link copied to clipboard
data class SearchAPIRequest(body: String? = null, contentType: String = "application/json", pathComponents: List<String> = listOf(), parameters: MutableMap<String, String> = mutableMapOf(), headers: MutableMap<String, Any> = mutableMapOf())
Link copied to clipboard
class SearchClient(val restClient: RestClient = KtorRestClient(), val json: Json = DEFAULT_JSON)

Search client that you can use to talk to Elasticsearch or Opensearch.

Link copied to clipboard
@Serializable
data class SearchEngineInformation(val name: String, val clusterName: String, val clusterUUID: String, val version: SearchEngineVersion)
Link copied to clipboard
@Serializable
data class SearchEngineVersion(val distribution: String?, val number: String, val buildFlavor: String?, val buildHash: String, val buildDate: String, val buildSnapshot: Boolean, val luceneVersion: String, val minimumWireCompatibilityVersion: String, val minimumIndexCompatibilityVersion: String)
Link copied to clipboard
Link copied to clipboard
@Serializable
data class SearchResponse(val took: Long?, val shards: Shards?, val timedOut: Boolean?, val hits: SearchResponse.Hits?, val aggregations: Aggregations?, val scrollId: String?, val pitId: String?, val pointInTimeId: String?, val suggest: Map<String, List<SearchResponse.Suggest>>?)
Link copied to clipboard
Link copied to clipboard
@Serializable
data class Shards(val total: Int, val successful: Int, val failed: Int, val skipped: Int? = null)
Link copied to clipboard
class SnapshotRepository : JsonDsl
Link copied to clipboard
class SniffingNodeSelector(initialNodes: Node, maxNodeAge: Duration = 1.minutes, https: Boolean = false, user: String? = null, password: String? = null) : NodeSelector

If you are running against a cluster without a node balancer you can use this node selector to make the client sniff nodes from the cluster.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Serializable
data class SumAggregationResult(val value: Double)
Link copied to clipboard
data class TaskId(val value: String)
Link copied to clipboard
@Serializable
data class TaskResponse(val task: String)
Link copied to clipboard
@Serializable
data class TermsAggregationResult(val docCountErrorUpperBound: Long, val sumOtherDocCount: Long, val buckets: List<JsonObject>) : BucketAggregationResult<TermsBucket>
Link copied to clipboard
@Serializable
data class TermsBucket(val key: String, val docCount: Long, val keyAsString: String?)
Link copied to clipboard
@Serializable
data class TopHitsAggregationResult(val hits: SearchResponse.Hits)
Link copied to clipboard
data class VariantInfo(val variant: SearchEngineVariant, val versionString: String)

Search engine variant meta data.

Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val DateHistogramAggregationResult.parsedBuckets: <Error class: unknown class>
val DateRangesAggregationResult.parsedBuckets: <Error class: unknown class>
val GeoTileGridResult.parsedBuckets: <Error class: unknown class>
val RangesAggregationResult.parsedBuckets: <Error class: unknown class>
val TermsAggregationResult.parsedBuckets: <Error class: unknown class>
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun SearchClient.analyze(target: String? = null, block: AnalyzeRequest.() -> Unit): AnalyzeResponse
Link copied to clipboard
Link copied to clipboard
suspend fun SearchClient.awaitTaskCompleted(id: TaskId, timeout: Duration, interval: Duration = 5.seconds): JsonObject?
suspend fun SearchClient.awaitTaskCompleted(id: String, timeout: Duration, interval: Duration = 5.seconds): JsonObject?

Polls the given task id to check if the task is completed. Waits for timeout and polls every interval to check if the task is completed.

Link copied to clipboard
Link copied to clipboard
fun Aggregations?.bucketScriptResult(name: Enum<*>, json: Json = DEFAULT_JSON): DoubleValueAggregationResult
fun Aggregations?.bucketScriptResult(name: String, json: Json = DEFAULT_JSON): DoubleValueAggregationResult
Link copied to clipboard
suspend fun SearchClient.bulk(payload: String, target: String? = null, pipeline: String? = null, refresh: Refresh? = null, routing: String? = null, timeout: Duration? = null, waitForActiveShards: String? = null, requireAlias: Boolean? = null, source: String? = null, sourceExcludes: String? = null, sourceIncludes: String? = null, extraParameters: Map<String, String>? = null): <Error class: unknown class>

Send a single bulk request. Consider using the variant that creates a BulkSession.

suspend fun SearchClient.bulk(bulkSize: Int = 100, target: String? = null, pipeline: String? = null, refresh: Refresh? = Refresh.WaitFor, routing: String? = null, timeout: Duration? = null, waitForActiveShards: String? = null, requireAlias: Boolean? = null, source: String? = null, sourceExcludes: String? = null, sourceIncludes: String? = null, failOnFirstError: Boolean = false, callBack: BulkItemCallBack? = null, closeOnRequestError: Boolean = true, extraParameters: Map<String, String>? = null, block: suspend BulkSession.() -> Unit)

Creates a bulk session that allows you to index, create, or delete items via the convenient kotlin DSL.

Link copied to clipboard
fun SearchClient.bulkSession(bulkSize: Int = 100, target: String? = null, pipeline: String? = null, refresh: Refresh? = null, routing: String? = null, timeout: Duration? = null, waitForActiveShards: String? = null, requireAlias: Boolean? = null, source: String? = null, sourceExcludes: String? = null, sourceIncludes: String? = null, failOnFirstError: Boolean = false, callBack: BulkItemCallBack? = null, closeOnRequestError: Boolean = true, extraParameters: Map<String, String>? = null): BulkSession
Link copied to clipboard
suspend fun SearchClient.cancelTask(id: String, waitForCompletion: Boolean = false, timeout: Duration = 1.minutes): JsonObject
Link copied to clipboard
fun Aggregations?.cardinalityResult(name: Enum<*>, json: Json = DEFAULT_JSON): LongValueAggregationResult
fun Aggregations?.cardinalityResult(name: String, json: Json = DEFAULT_JSON): LongValueAggregationResult
Link copied to clipboard
suspend fun SearchClient.clusterHealth(extraParameters: Map<String, String>? = null): ClusterHealthResponse
Link copied to clipboard
suspend fun SearchClient.count(target: String? = null, query: ESQuery, allowNoIndices: Boolean? = null, expandWildcards: ExpandWildCards? = null, ignoreThrottled: Boolean? = null, ignoreUnavailable: Boolean? = null, minScore: Double? = null, preference: String? = null, routing: String? = null, terminateAfter: Int? = null): CountResponse

Variant of the _count api that allows you to pass in an ESQuery object. It will be set as the query on the json body that is sent to _count.

suspend fun SearchClient.count(target: String? = null, allowNoIndices: Boolean? = null, expandWildcards: ExpandWildCards? = null, ignoreThrottled: Boolean? = null, ignoreUnavailable: Boolean? = null, minScore: Double? = null, preference: String? = null, routing: String? = null, terminateAfter: Int? = null, block: SearchDSL.() -> Unit): CountResponse

Variant of the _count api that takes a search dsl block so you can set the query. Note, not all parts of the search dsl are supported by _count. E.g. adding sorting would be an error.

suspend fun SearchClient.count(target: String? = null, rawJson: String? = null, allowNoIndices: Boolean? = null, expandWildcards: ExpandWildCards? = null, ignoreThrottled: Boolean? = null, ignoreUnavailable: Boolean? = null, minScore: Double? = null, preference: String? = null, routing: String? = null, terminateAfter: Int? = null): CountResponse

Variant of the _count api that takes an optional rawBody. Leaving the body empty means doing a match_all search.

Link copied to clipboard
Link copied to clipboard
inline suspend fun <T> BulkSession.create(doc: T, index: String? = null, id: String? = null, requireAlias: Boolean? = null, routing: String? = null)
Link copied to clipboard
suspend fun SearchClient.createDataStream(name: String): JsonObject
Link copied to clipboard
suspend fun SearchClient.createIndex(name: String, mapping: IndexSettingsAndMappingsDSL, waitForActiveShards: Int? = null, masterTimeOut: Duration? = null, timeout: Duration? = null, extraParameters: Map<String, String>? = null): IndexCreateResponse
suspend fun SearchClient.createIndex(name: String, waitForActiveShards: Int? = null, masterTimeOut: Duration? = null, timeout: Duration? = null, extraParameters: Map<String, String>? = null, block: IndexSettingsAndMappingsDSL.() -> Unit? = null): IndexCreateResponse
suspend fun SearchClient.createIndex(name: String, mappingAndSettings: String, waitForActiveShards: Int? = null, masterTimeOut: Duration? = null, timeout: Duration? = null, extraParameters: Map<String, String>? = null): IndexCreateResponse
Link copied to clipboard
suspend fun SearchClient.createIndexTemplate(templateId: String, block: IndexTemplate.() -> Unit): JsonObject
Link copied to clipboard
suspend fun SearchClient.createPointInTime(name: String, keepAlive: Duration): String

Create a point in time for use with e.g. search_after.

Link copied to clipboard
fun Aggregations?.dateHistogramResult(name: Enum<*>, json: Json = DEFAULT_JSON): DateHistogramAggregationResult
Link copied to clipboard
Link copied to clipboard
fun Aggregations?.dateRangesResult(name: Enum<*>, json: Json = DEFAULT_JSON): DateRangesAggregationResult
fun Aggregations?.dateRangesResult(name: String, json: Json = DEFAULT_JSON): DateRangesAggregationResult
Link copied to clipboard
fun HttpClientConfig<*>.defaultInit(logging: Boolean, user: String?, password: String?, elasticApiKey: String?)
Link copied to clipboard
expect fun defaultKtorHttpClient(logging: Boolean = false, user: String? = null, password: String? = null, elasticApiKey: String? = null, block: HttpClientConfig<*>.() -> Unit): HttpClient
actual fun defaultKtorHttpClient(logging: Boolean, user: String?, password: String?, elasticApiKey: String?, block: HttpClientConfig<*>.() -> Unit): HttpClient
actual fun defaultKtorHttpClient(logging: Boolean, user: String?, password: String?, elasticApiKey: String?, block: HttpClientConfig<*>.() -> Unit): HttpClient
actual fun defaultKtorHttpClient(logging: Boolean, user: String?, password: String?, elasticApiKey: String?, block: HttpClientConfig<*>.() -> Unit): HttpClient
actual fun defaultKtorHttpClient(logging: Boolean, user: String?, password: String?, elasticApiKey: String?, block: HttpClientConfig<*>.() -> Unit): HttpClient
actual fun defaultKtorHttpClient(logging: Boolean, user: String?, password: String?, elasticApiKey: String?, block: HttpClientConfig<*>.() -> Unit): HttpClient
actual fun defaultKtorHttpClient(logging: Boolean, user: String?, password: String?, elasticApiKey: String?, block: HttpClientConfig<*>.() -> Unit): HttpClient
actual fun defaultKtorHttpClient(logging: Boolean, user: String?, password: String?, elasticApiKey: String?, block: HttpClientConfig<*>.() -> Unit): HttpClient
Link copied to clipboard
Link copied to clipboard
suspend fun SearchClient.deleteByQuery(target: String?, dsl: SearchDSL, allowNoIndices: Boolean? = null, analyzer: String? = null, analyzeWildcard: Boolean? = null, conflicts: String? = null, defaultOperator: SearchOperator? = null, df: String? = null, expandWildcards: ExpandWildCards? = null, ignoreUnavailable: Boolean? = null, lenient: Boolean? = null, maxDocs: Int? = null, preference: String? = null, q: String? = null, refresh: Boolean? = null, requestCache: Boolean? = null, requestsPerSecond: Int? = null, routing: String? = null, scroll: String? = null, scrollSize: Int? = null, searchType: SearchType? = null, searchTimeout: String? = null, slices: Int? = null, sort: String? = null, stats: String? = null, terminateAfter: Int? = null, timeout: Duration? = null, version: Boolean? = null, waitForExtraShards: String? = null, extraParameters: Map<String, String>? = null): DeleteByQueryResponse
suspend fun SearchClient.deleteByQuery(target: String?, allowNoIndices: Boolean? = null, analyzer: String? = null, analyzeWildcard: Boolean? = null, conflicts: String? = null, defaultOperator: SearchOperator? = null, df: String? = null, expandWildcards: ExpandWildCards? = null, ignoreUnavailable: Boolean? = null, lenient: Boolean? = null, maxDocs: Int? = null, preference: String? = null, q: String? = null, refresh: Boolean? = null, requestCache: Boolean? = null, requestsPerSecond: Int? = null, routing: String? = null, scroll: String? = null, scrollSize: Int? = null, searchType: SearchType? = null, searchTimeout: String? = null, slices: Int? = null, sort: String? = null, stats: String? = null, terminateAfter: Int? = null, timeout: Duration? = null, version: Boolean? = null, waitForExtraShards: String? = null, extraParameters: Map<String, String>? = null, block: SearchDSL.() -> Unit): DeleteByQueryResponse
suspend fun SearchClient.deleteByQuery(target: String?, rawJson: String?, allowNoIndices: Boolean? = null, analyzer: String? = null, analyzeWildcard: Boolean? = null, conflicts: String? = null, defaultOperator: SearchOperator? = null, df: String? = null, expandWildcards: ExpandWildCards? = null, ignoreUnavailable: Boolean? = null, lenient: Boolean? = null, maxDocs: Int? = null, preference: String? = null, q: String? = null, refresh: Boolean? = null, requestCache: Boolean? = null, requestsPerSecond: Int? = null, routing: String? = null, scroll: String? = null, scrollSize: Int? = null, searchType: SearchType? = null, searchTimeout: String? = null, slices: Int? = null, sort: String? = null, stats: String? = null, terminateAfter: Int? = null, timeout: Duration? = null, version: Boolean? = null, waitForExtraShards: String? = null, extraParameters: Map<String, String>? = null): DeleteByQueryResponse
Link copied to clipboard
suspend fun SearchClient.deleteComponentTemplate(templateId: String): JsonObject
Link copied to clipboard
suspend fun SearchClient.deleteDataStream(name: String): JsonObject
Link copied to clipboard
suspend fun SearchClient.deleteDocument(target: String, id: String, ifSeqNo: Long? = null, ifPrimaryTerm: Long? = null, refresh: Refresh? = null, routing: String? = null, timeout: Duration? = null, version: Long? = null, versionType: VersionType? = null, waitForActiveShards: String? = null, extraParameters: Map<String, String>? = null): DocumentIndexResponse
Link copied to clipboard
suspend fun SearchClient.deleteIlmPolicy(policyId: String): JsonObject
Link copied to clipboard
suspend fun SearchClient.deleteIndex(target: String, masterTimeOut: Duration? = null, timeout: Duration? = null, ignoreUnavailable: Boolean? = null, extraParameters: Map<String, String>? = null): JsonObject
Link copied to clipboard
suspend fun SearchClient.deleteIndexTemplate(templateId: String): JsonObject
Link copied to clipboard
suspend fun SearchClient.deletePointInTime(id: String): JsonObject
Link copied to clipboard
suspend fun SearchClient.deleteScroll(scrollId: String?): JsonObject

Delete a scroll by id.

Link copied to clipboard
suspend fun SearchClient.deleteSnapshot(repositoryName: String, snapshotName: String, waitForCompletion: Boolean = false, timeout: Duration = 1.minutes): JsonObject
Link copied to clipboard
suspend fun SearchClient.deleteSnapshotRepository(repositoryName: String): JsonObject
Link copied to clipboard
inline fun <T> SourceInformation.document(json: Json = DEFAULT_JSON): T
Link copied to clipboard
inline fun <T> MGetResponse.documents(json: Json = DEFAULT_JSON): List<T>
Link copied to clipboard
suspend fun SearchClient.exists(name: String): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Aggregations?.filtersResult(name: Enum<*>, json: Json = DEFAULT_JSON): FiltersAggregationResult
fun Aggregations?.filtersResult(name: String, json: Json = DEFAULT_JSON): FiltersAggregationResult
Link copied to clipboard
Link copied to clipboard
fun Aggregations?.geoTileGridResult(name: Enum<*>, json: Json = DEFAULT_JSON): GeoTileGridResult
fun Aggregations?.geoTileGridResult(name: String, json: Json = DEFAULT_JSON): GeoTileGridResult
Link copied to clipboard
Link copied to clipboard
inline fun <T> Aggregations?.getAggResult(name: Enum<*>, json: Json = DEFAULT_JSON): T
inline fun <T> Aggregations?.getAggResult(name: String, json: Json = DEFAULT_JSON): T
Link copied to clipboard
suspend fun SearchClient.getAliases(target: String? = null): Map<String, AliasResponse>

Returns the aliases for a target.

Link copied to clipboard

Returns the set of alias names for an index or an empty set.

Link copied to clipboard
suspend fun SearchClient.getDocument(target: String, id: String, preference: String? = null, realtime: Boolean? = null, refresh: Refresh? = null, routing: String? = null, storedFields: String? = null, source: String? = null, sourceExcludes: String? = null, sourceIncludes: String? = null, version: Long? = null, versionType: VersionType? = null, extraParameters: Map<String, String>? = null): GetDocumentResponse
Link copied to clipboard
suspend fun SearchClient.getIlmPolicy(policyId: String): JsonObject
Link copied to clipboard
suspend fun SearchClient.getIndex(name: String): JsonObject
Link copied to clipboard

Returns the set of indices that have the alias. If you call this on an index, the returned set will just contain the index.

Link copied to clipboard
suspend fun SearchClient.getIndexMappings(name: String): JsonObject
Link copied to clipboard
suspend fun SearchClient.getSnapshotRepository(repositoryName: String?): JsonObject
Link copied to clipboard
suspend fun SearchClient.getTask(id: String?, waitForCompletion: Boolean = false, timeout: Duration = 1.minutes): JsonObject
Link copied to clipboard
suspend fun RestClient.head(block: SearchAPIRequest.() -> Unit): RestResponse
Link copied to clipboard
inline suspend fun <T> BulkSession.index(doc: T, index: String? = null, id: String? = null, requireAlias: Boolean? = null, routing: String? = null)
Link copied to clipboard
suspend fun SearchClient.indexDocument(target: String, serializedJson: String, id: String? = null, ifSeqNo: Long? = null, ifPrimaryTerm: Long? = null, opType: OperationType? = null, pipeline: String? = null, refresh: Refresh? = null, routing: String? = null, timeout: Duration? = null, version: Long? = null, versionType: VersionType? = null, waitForActiveShards: String? = null, requireAlias: Boolean? = null, extraParameters: Map<String, String>? = null): DocumentIndexResponse
inline suspend fun <T> SearchClient.indexDocument(target: String, document: T, id: String? = null, ifSeqNo: Long? = null, ifPrimaryTerm: Long? = null, opType: OperationType? = null, pipeline: String? = null, refresh: Refresh? = null, routing: String? = null, timeout: Duration? = null, version: Long? = null, versionType: VersionType? = null, waitForActiveShards: String? = null, requireAlias: Boolean? = null, extraParameters: Map<String, String>? = null, json: Json = DEFAULT_JSON): DocumentIndexResponse
Link copied to clipboard
fun ktorClientWithCIOEngine(logging: Boolean, user: String?, password: String?, elasticApiKey: String?, block: HttpClientConfig<*>.() -> Unit): HttpClient
Link copied to clipboard
fun ktorClientWithJavaEngine(logging: Boolean, user: String?, password: String?, elasticApiKey: String?, block: HttpClientConfig<*>.() -> Unit): HttpClient
Link copied to clipboard
suspend fun SearchClient.listSnapshots(repositoryName: String, pattern: String = "_all"): JsonObject
Link copied to clipboard
fun Aggregations?.maxResult(name: Enum<*>, json: Json = DEFAULT_JSON): DoubleValueAggregationResult
fun Aggregations?.maxResult(name: String, json: Json = DEFAULT_JSON): DoubleValueAggregationResult
Link copied to clipboard
suspend fun SearchClient.mGet(index: String? = null, preference: String? = null, realtime: Boolean? = null, refresh: Refresh? = null, routing: String? = null, storedFields: String? = null, source: String? = null, block: MGetRequest.() -> Unit): MGetResponse
Link copied to clipboard
fun Aggregations?.minResult(name: Enum<*>, json: Json = DEFAULT_JSON): DoubleValueAggregationResult
fun Aggregations?.minResult(name: String, json: Json = DEFAULT_JSON): DoubleValueAggregationResult
Link copied to clipboard
suspend fun SearchClient.msearch(target: String?, allowNoIndices: Boolean? = null, cssMinimizeRoundtrips: Boolean? = null, expandWildcards: ExpandWildCards? = null, ignoreThrottled: Boolean? = null, ignoreUnavailable: Boolean? = null, maxConcurrentSearches: Int? = null, maxConcurrentShardRequests: Int? = null, preFilterShardSize: Int? = null, routing: String? = null, searchType: SearchType? = null, typedKeys: Boolean? = null, block: MsearchRequest.() -> Unit): MultiSearchResponse
suspend fun SearchClient.msearch(target: String? = null, body: String?, allowNoIndices: Boolean? = null, cssMinimizeRoundtrips: Boolean? = null, expandWildcards: ExpandWildCards? = null, ignoreThrottled: Boolean? = null, ignoreUnavailable: Boolean? = null, maxConcurrentSearches: Int? = null, maxConcurrentShardRequests: Int? = null, preFilterShardSize: Int? = null, routing: String? = null, searchType: SearchType? = null, typedKeys: Boolean? = null): MultiSearchResponse
Link copied to clipboard
Link copied to clipboard
fun MatchedQueries?.names(json: Json = DEFAULT_JSON): List<String>

If include_named_queries_score parameter is not true only ES returns only query names for each Hit. If include_named_queries_score is true please use the scoreByName function.

Link copied to clipboard
inline fun <T> JsonObject.parse(json: Json = DEFAULT_JSON): T
fun <T> Result<RestResponse>.parse(deserializationStrategy: DeserializationStrategy<T>, json: Json = DEFAULT_JSON): T
fun <T> JsonObject.parse(deserializationStrategy: DeserializationStrategy<T>, json: Json = DEFAULT_JSON): T
fun <T> JsonObject.parse(json: Json = DEFAULT_JSON, deserializationStrategy: DeserializationStrategy<T>): T
Link copied to clipboard
inline fun <T> SearchResponse.Hit.parseHit(json: Json = DEFAULT_JSON): T
fun <T> SearchResponse.Hit.parseHit(deserializationStrategy: DeserializationStrategy<T>, json: Json = DEFAULT_JSON): T
Link copied to clipboard
inline fun <T> Flow<SearchResponse.Hit>.parseHits(): Flow<T>
fun <T : Any> Flow<SearchResponse.Hit>.parseHits(deserializationStrategy: ModelSerializationStrategy<T>): Flow<T>
fun <T> Flow<SearchResponse.Hit>.parseHits(deserializationStrategy: DeserializationStrategy<T>, json: Json = DEFAULT_JSON): Flow<T>

fun <T : Any> SearchResponse.parseHits(deserializationStrategy: ModelSerializationStrategy<T>): List<T>

Version of parseHits that reuses the ModelSerializationStrategy.

inline fun <T> SearchResponse.parseHits(json: Json = DEFAULT_JSON): List<T>

Quick way to get the document hits from a SearchResponse. You can override the default json if you need to.

fun <T> SearchResponse.parseHits(deserializationStrategy: DeserializationStrategy<T>, json: Json = DEFAULT_JSON): List<T>

Non reified version of parseHits that takes a deserializationStrategy.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Aggregations?.rangesResult(name: Enum<*>, json: Json = DEFAULT_JSON): RangesAggregationResult
fun Aggregations?.rangesResult(name: String, json: Json = DEFAULT_JSON): RangesAggregationResult
Link copied to clipboard
suspend fun SearchClient.registerSnapshotRepository(repositoryName: String, repository: SnapshotRepository): JsonObject
suspend fun SearchClient.registerSnapshotRepository(repositoryName: String, block: SnapshotRepository.() -> Unit)
Link copied to clipboard
suspend fun SearchClient.reindex(refresh: Boolean? = null, timeout: Duration? = null, waitForActiveShards: String? = null, requestsPerSecond: Int? = null, requireAlias: Boolean? = null, scroll: Duration? = null, slices: Int? = null, maxDocs: Int? = null, block: ReindexDSL.() -> Unit): ReindexResponse

Reindex and waits for completion. Returns a reindex response indicating what was reindexed.

Link copied to clipboard
suspend fun SearchClient.reindexAndAwaitTask(refresh: Boolean? = null, timeout: Duration = 20.minutes, waitForActiveShards: String? = null, requestsPerSecond: Int? = null, requireAlias: Boolean? = null, scroll: Duration? = null, slices: Int? = null, maxDocs: Int? = null, pollInterval: Duration = 5.seconds, block: ReindexDSL.() -> Unit): ReindexResponse?

Reindexes using a background task in ES and polls for that task to complete every pollInterval for a maximum of timeout. Note: the same timeout is passed on to the reindex task

Link copied to clipboard
suspend fun SearchClient.reindexAsync(refresh: Boolean? = null, timeout: Duration? = null, waitForActiveShards: String? = null, requestsPerSecond: Int? = null, requireAlias: Boolean? = null, scroll: Duration? = null, slices: Int? = null, maxDocs: Int? = null, block: ReindexDSL.() -> Unit): TaskId

Reindexes using a background task in ES. Returns a TaskId response with an id that you can use with the task api.

Link copied to clipboard
suspend fun SearchClient.restoreSnapshot(repositoryName: String, snapshotName: String, waitForCompletion: Boolean = false, timeout: Duration = 1.minutes): JsonObject
Link copied to clipboard

Http GET to /

Link copied to clipboard
Link copied to clipboard
fun MatchedQueries?.scoreByName(json: Json = DEFAULT_JSON): Map<String, Double>

The request parameter named include_named_queries_score controls whether scores associated with the matched queries are returned or not. When set, the response includes a matched_queries map that contains the name of the query that matched as a key and its associated score as the value.

Link copied to clipboard

Scroll through search results for a scrolling search.

suspend fun SearchClient.scroll(scrollId: String, scroll: Duration = 60.seconds): SearchResponse
Link copied to clipboard
suspend fun SearchClient.search(target: String?, allowNoIndices: Boolean? = null, allowPartialSearchResults: Boolean? = null, analyzer: String? = null, analyzeWildcard: Boolean? = null, batchedReduceSize: Int? = null, ccsMinimizeRoundtrips: Boolean? = null, defaultOperator: SearchOperator? = null, df: String? = null, docvalueFields: String? = null, expandWildcards: ExpandWildCards? = null, explain: Boolean? = null, from: Int? = null, ignoreThrottled: Boolean? = null, ignoreUnavailable: Boolean? = null, include_named_queries_score: Boolean? = null, lenient: Boolean? = null, maxConcurrentShardRequests: Int? = null, preFilterShardSize: Int? = null, preference: String? = null, q: String? = null, requestCache: Boolean? = null, restTotalHitsAsInt: Boolean? = null, routing: String? = null, scroll: String? = null, searchType: SearchType? = null, seqNoPrimaryTerm: Boolean? = null, size: Int? = null, sort: String? = null, _source: String? = null, sourceExcludes: String? = null, sourceIncludes: String? = null, stats: String? = null, storedFields: String? = null, suggestField: String? = null, suggestMode: SuggestMode? = null, suggestSize: Int? = null, suggestText: String? = null, terminateAfter: Int? = null, timeout: Duration? = null, trackScores: Boolean? = null, trackTotalHits: Boolean? = null, typedKeys: Boolean? = null, version: Boolean? = null, extraParameters: Map<String, String>? = null, block: SearchDSL.() -> Unit? = null): SearchResponse
suspend fun SearchClient.search(target: String?, dsl: SearchDSL, allowNoIndices: Boolean? = null, allowPartialSearchResults: Boolean? = null, analyzer: String? = null, analyzeWildcard: Boolean? = null, batchedReduceSize: Int? = null, ccsMinimizeRoundtrips: Boolean? = null, defaultOperator: SearchOperator? = null, df: String? = null, docvalueFields: String? = null, expandWildcards: ExpandWildCards? = null, explain: Boolean? = null, from: Int? = null, ignoreThrottled: Boolean? = null, ignoreUnavailable: Boolean? = null, include_named_queries_score: Boolean? = null, lenient: Boolean? = null, maxConcurrentShardRequests: Int? = null, preFilterShardSize: Int? = null, preference: String? = null, q: String? = null, requestCache: Boolean? = null, restTotalHitsAsInt: Boolean? = null, routing: String? = null, scroll: String? = null, searchType: SearchType? = null, seqNoPrimaryTerm: Boolean? = null, size: Int? = null, sort: String? = null, source: String? = null, sourceExcludes: String? = null, sourceIncludes: String? = null, stats: String? = null, storedFields: String? = null, suggestField: String? = null, suggestMode: SuggestMode? = null, suggestSize: Int? = null, suggestText: String? = null, terminateAfter: Int? = null, timeout: Duration? = null, trackScores: Boolean? = null, trackTotalHits: Boolean? = null, typedKeys: Boolean? = null, version: Boolean? = null, extraParameters: Map<String, String>? = null, retries: Int = 3, retryDelay: Duration = 2.seconds): SearchResponse
suspend fun SearchClient.search(target: String?, rawJson: String?, allowNoIndices: Boolean? = null, allowPartialSearchResults: Boolean? = null, analyzer: String? = null, analyzeWildcard: Boolean? = null, batchedReduceSize: Int? = null, ccsMinimizeRoundtrips: Boolean? = null, defaultOperator: SearchOperator? = null, df: String? = null, docValueFields: String? = null, expandWildcards: ExpandWildCards? = null, explain: Boolean? = null, from: Int? = null, ignoreThrottled: Boolean? = null, ignoreUnavailable: Boolean? = null, include_named_queries_score: Boolean? = null, lenient: Boolean? = null, maxConcurrentShardRequests: Int? = null, preFilterShardSize: Int? = null, preference: String? = null, q: String? = null, requestCache: Boolean? = null, restTotalHitsAsInt: Boolean? = null, routing: String? = null, scroll: String? = null, searchType: SearchType? = null, seqNoPrimaryTerm: Boolean? = null, size: Int? = null, sort: String? = null, source: String? = null, sourceExcludes: String? = null, sourceIncludes: String? = null, stats: String? = null, storedFields: String? = null, suggestField: String? = null, suggestMode: SuggestMode? = null, suggestSize: Int? = null, suggestText: String? = null, terminateAfter: Int? = null, timeout: Duration? = null, trackScores: Boolean? = null, trackTotalHits: Boolean? = null, typedKeys: Boolean? = null, version: Boolean? = null, extraParameters: Map<String, String>? = null, retries: Int = 3, retryDelay: Duration = 2.seconds): SearchResponse
Link copied to clipboard
suspend fun SearchClient.searchAfter(target: String, keepAlive: Duration = 1.minutes, optInToCustomSort: Boolean = false, block: SearchDSL.() -> Unit? = null): Pair<SearchResponse, Flow<SearchResponse.Hit>>

suspend fun SearchClient.searchAfter(target: String, keepAlive: Duration, query: SearchDSL, optInToCustomSort: Boolean = false, retries: Int = 3, retryDelay: Duration = 2.seconds): Pair<SearchResponse, Flow<SearchResponse.Hit>>

Perform a deep paging search using point in time and search after.

Link copied to clipboard
suspend fun SearchClient.setIlmPolicy(policyId: String, block: IMLPhases.() -> Unit): AcknowledgedResponse
Link copied to clipboard
expect fun simpleIndexProvider(initialIndex: Int = 0): IndexProvider
actual fun simpleIndexProvider(initialIndex: Int): IndexProvider
actual fun simpleIndexProvider(initialIndex: Int): IndexProvider
actual fun simpleIndexProvider(initialIndex: Int): IndexProvider
actual fun simpleIndexProvider(initialIndex: Int): IndexProvider
actual fun simpleIndexProvider(initialIndex: Int): IndexProvider
actual fun simpleIndexProvider(initialIndex: Int): IndexProvider
actual fun simpleIndexProvider(initialIndex: Int): IndexProvider
Link copied to clipboard
Link copied to clipboard
fun Aggregations?.sumAggregationResult(name: Enum<*>, json: Json = DEFAULT_JSON): TopHitsAggregationResult
fun Aggregations?.sumAggregationResult(name: String, json: Json = DEFAULT_JSON): SumAggregationResult
Link copied to clipboard
suspend fun SearchClient.takeSnapshot(repositoryName: String, snapshotName: String = formatTimestamp(), waitForCompletion: Boolean = false, timeout: Duration = 1.minutes): JsonObject
Link copied to clipboard
fun Aggregations?.termsResult(name: Enum<*>, json: Json = DEFAULT_JSON): TermsAggregationResult
fun Aggregations?.termsResult(name: String, json: Json = DEFAULT_JSON): TermsAggregationResult
Link copied to clipboard
expect fun threadId(): String?

On JVM this will return the current thread name, on kotlin-js this will return null

actual fun threadId(): String?

On JVM this will return the current thread name, otherwise this will return null and pick a random node

actual fun threadId(): String?
actual fun threadId(): String?
actual fun threadId(): String?

On JVM this will return the current thread name, otherwise this will return null and pick a random node

actual fun threadId(): String?

On JVM this will return the current thread name, otherwise this will return null and pick a random node

actual fun threadId(): String?

On JVM this will return the current thread name, otherwise this will return null and pick a random node

actual fun threadId(): String?

On JVM this will return the current thread name, on kotlin-js this will return null

Link copied to clipboard
fun Aggregations?.topHitResult(name: Enum<*>, json: Json = DEFAULT_JSON): TopHitsAggregationResult
fun Aggregations?.topHitResult(name: String, json: Json = DEFAULT_JSON): TopHitsAggregationResult
Link copied to clipboard
inline suspend fun <T> BulkSession.update(doc: T, id: String, index: String? = null, requireAlias: Boolean? = null, docAsUpsert: Boolean? = null)
inline suspend fun <T> BulkSession.update(script: Script, id: String, upsert: T, index: String? = null, requireAlias: Boolean? = null)
Link copied to clipboard

Atomically process alias updates with a DSL.

Link copied to clipboard
suspend fun SearchClient.updateComponentTemplate(templateId: String, block: IndexSettingsAndMappingsDSL.() -> Unit): JsonObject
Link copied to clipboard
suspend fun SearchClient.updateDocument(target: String, id: String, script: Script, upsertJson: String? = null, ifSeqNo: Long? = null, ifPrimaryTerm: Long? = null, requireAlias: Boolean? = null, retryOnConflict: Int? = null, refresh: Refresh? = null, routing: String? = null, source: String? = null, sourceIncludes: String? = null, sourceExcludes: String? = null, timeout: Duration? = null, waitForActiveShards: String? = null, extraParameters: Map<String, String>? = null): DocumentUpdateResponse
suspend fun SearchClient.updateDocument(target: String, id: String, docJson: String, detectNoop: Boolean? = null, ifSeqNo: Long? = null, ifPrimaryTerm: Long? = null, requireAlias: Boolean? = null, retryOnConflict: Int? = null, refresh: Refresh? = null, routing: String? = null, source: String? = null, sourceIncludes: String? = null, sourceExcludes: String? = null, timeout: Duration? = null, waitForActiveShards: String? = null, extraParameters: Map<String, String>? = null): DocumentUpdateResponse
inline suspend fun <T> SearchClient.updateDocument(target: String, id: String, doc: T, json: Json = DEFAULT_JSON, detectNoop: Boolean? = null, ifSeqNo: Long? = null, ifPrimaryTerm: Long? = null, requireAlias: Boolean? = null, retryOnConflict: Int? = null, refresh: Refresh? = null, routing: String? = null, source: String? = null, sourceIncludes: String? = null, sourceExcludes: String? = null, timeout: Duration? = null, waitForActiveShards: String? = null, extraParameters: Map<String, String>? = null): DocumentUpdateResponse
inline suspend fun <T> SearchClient.updateDocument(target: String, id: String, script: Script, upsertJson: T, json: Json = DEFAULT_JSON, ifSeqNo: Long? = null, ifPrimaryTerm: Long? = null, requireAlias: Boolean? = null, retryOnConflict: Int? = null, refresh: Refresh? = null, routing: String? = null, source: String? = null, sourceIncludes: String? = null, sourceExcludes: String? = null, timeout: Duration? = null, waitForActiveShards: String? = null, extraParameters: Map<String, String>? = null): DocumentUpdateResponse
Link copied to clipboard
suspend fun SearchClient.verifySnapshotRepository(repositoryName: String): JsonObject