You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
703 B
Kotlin

package moe.odango.index.utils
import io.inbot.eskotlinwrapper.MapBackedProperties
import io.inbot.eskotlinwrapper.dsl.ESQuery
class NestedQuery : ESQuery(name = "nested") {
var path: String by queryDetails.property()
var ignoreUnmapped: Boolean by queryDetails.property()
var innerHits: Map<Any, Any?> by queryDetails.property()
var scoreMode: ScoreMode by queryDetails.property()
var query: ESQuery by queryDetails.esQueryProperty()
}
fun nested(path: String, config: NestedQuery.() -> Unit): NestedQuery {
val q = NestedQuery()
q.path = path
config(q)
return q
}
@Suppress("EnumEntryName")
enum class ScoreMode {
avg,
max,
min,
none,
sum
}