BaseSearchQuery

abstract class BaseSearchQuery<S : BaseDocSource, T : BaseSearchQuery<S, T>>(docSourceFactory: (<ERROR CLASS>) -> S, query: QueryExpression?, params: Params)

An abstract class that holds all the search query builder methods. Inheritors of the class can implement some shortcut methods. For instance SearchQuery.execute which can be suspendable or blocking.

Constructors

BaseSearchQuery
Link copied to clipboard
fun <S : BaseDocSource> BaseSearchQuery(docSourceFactory: (<ERROR CLASS>) -> S, query: QueryExpression? = null, params: Params = Params())

Types

Companion
Link copied to clipboard
object Companion

Functions

aggs
Link copied to clipboard
fun aggs(clear: SearchQuery.CLEAR): T
Clears the existing aggregations.
fun aggs(vararg aggregations: <ERROR CLASS><String, Aggregation<*>>): T
Adds aggregations to the existing query aggregations.
fun aggs(aggregations: Map<String, Aggregation<*>>): T
Adds aggregations to the existing query aggregations.
clone
Link copied to clipboard
fun clone(): T
Clones this search query builder.
docvalueFields
Link copied to clipboard
fun docvalueFields(clear: SearchQuery.CLEAR): T
fun docvalueFields(vararg fields: FieldFormat): T
ext
Link copied to clipboard
fun ext(clear: SearchQuery.CLEAR): T
fun ext(vararg extensions: SearchExt): T
fields
Link copied to clipboard
fun fields(clear: SearchQuery.CLEAR): T
fun fields(vararg fields: FieldFormat): T
filter
Link copied to clipboard
fun filter(clear: SearchQuery.CLEAR): T
Clears the existing filters.
fun filter(vararg filters: QueryExpression): T
Combines all the filter expressions together and wraps the existing query using the dev.evo.elasticmagic.query.Bool query expression.
from
Link copied to clipboard
fun from(from: Int?): T
postFilter
Link copied to clipboard
fun postFilter(clear: SearchQuery.CLEAR): T
Clears the existing post filters.
fun postFilter(vararg filters: QueryExpression): T
Filter expressions in the post filter will be applied after the aggregations are calculated.
prepare
Link copied to clipboard
fun prepare(): PreparedSearchQuery<S>
Makes an immutable view of the search query.
query
Link copied to clipboard
fun query(query: QueryExpression?): T
Replaces main query expression.
queryNode
Link copied to clipboard
inline fun <N : QueryExpressionNode<N>> queryNode(handle: NodeHandle<N>, block: (N) -> Unit): T
Allows modifying specific query expression node using handle of the node.
requestCache
Link copied to clipboard
fun requestCache(requestCache: Boolean?): T
rescore
Link copied to clipboard
fun rescore(clear: SearchQuery.CLEAR): T
Clears the existing rescorers.
fun rescore(vararg rescores: Rescore): T
Adds rescores to the existing query rescorers.
routing
Link copied to clipboard
fun routing(routing: Long?): T
fun routing(routing: String?): T
scriptFields
Link copied to clipboard
fun scriptFields(clear: SearchQuery.CLEAR): T
fun scriptFields(vararg fields: <ERROR CLASS><String, Script>): T
searchParams
Link copied to clipboard
fun searchParams(vararg params: <ERROR CLASS><String, Any?>): T
searchType
Link copied to clipboard
fun searchType(searchType: SearchType?): T
seqNoPrimaryTerm
Link copied to clipboard
fun seqNoPrimaryTerm(seqNoPrimaryTerm: Boolean?): T
size
Link copied to clipboard
fun size(size: Int?): T
sort
Link copied to clipboard
fun sort(clear: SearchQuery.CLEAR): T
Clears the existing sorts.
fun sort(vararg sorts: Sort): T
Adds sorts to the existing query sorting expressions.
fun sort(sorts: List<Sort>): T
Adds sorts from a list to the existing query sorting expressions.
source
Link copied to clipboard
fun source(clear: SearchQuery.CLEAR): T
Clears source filtering values that were previously set.
fun source(vararg includes: FieldOperations<*>): T
Adds includes field lists to the document source fields filtering.
fun source(enable: Boolean): T
Disables or enables document's source filtering.
fun source(includes: List<FieldOperations<*>> = emptyList(), excludes: List<FieldOperations<*>> = emptyList()): T
Adds includes and excludes field lists to the document source fields filtering.
stats
Link copied to clipboard
fun stats(stats: String?): T
storedFields
Link copied to clipboard
fun storedFields(clear: SearchQuery.CLEAR): T
fun storedFields(vararg fields: FieldOperations<*>): T
terminateAfter
Link copied to clipboard
fun terminateAfter(terminateAfter: Int?): T
trackScores
Link copied to clipboard
fun trackScores(trackScores: Boolean?): T
If trackScores is true forces computing scores even when sorting on a field.
trackTotalHits
Link copied to clipboard
fun trackTotalHits(trackTotalHits: Boolean?): T
When trackTotalHits is true the search query will always count the total number of hits that match the query.
version
Link copied to clipboard
fun version(version: Boolean?): T

Inheritors

SearchQuery
Link copied to clipboard

Extensions

usingIndex
Link copied to clipboard
fun <S : BaseDocSource> BaseSearchQuery<S, *>.usingIndex(indexName: String): SearchQueryWithIndex<S>