shouldDsl

fun shouldDsl(block: QueryVariantDsl.() -> Unit)

Adds queries to the should occurrence.

Documents should match at least one query in this occurrence to boost the relevance score. These queries are optional but affect scoring when matched.

Example

val document = Metamodels.product

BoolQuery.of {
it.boolQueryDsl {
shouldDsl {
document.brand term "Dell"
document.tags.containsTerms("featured", "sale")
}
}
}

See also

for available query types