From 46fdb19a7e19c0e637e9cdb11f7c458d05ddf2df Mon Sep 17 00:00:00 2001 From: Thanh Le Date: Mon, 10 Jun 2024 14:19:18 +0700 Subject: [PATCH] Use filter instead of must https://stackoverflow.com/questions/43349044/what-is-the-difference-between-must-and-filter-in-query-dsl-in-elasticsearch --- modules/core/src/main/scala/package.scala | 2 +- modules/core/src/main/scala/study.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/src/main/scala/package.scala b/modules/core/src/main/scala/package.scala index 20a46b3a..9ca8a0d0 100644 --- a/modules/core/src/main/scala/package.scala +++ b/modules/core/src/main/scala/package.scala @@ -14,4 +14,4 @@ extension (queries: List[Query]) def compile: Query = queries match case Nil => matchAllQuery() case q :: Nil => q - case _ => boolQuery().must(queries) + case _ => boolQuery().filter(queries) diff --git a/modules/core/src/main/scala/study.scala b/modules/core/src/main/scala/study.scala index d1881f7e..eda6af30 100644 --- a/modules/core/src/main/scala/study.scala +++ b/modules/core/src/main/scala/study.scala @@ -59,7 +59,7 @@ object StudyQuery: multiMatchQuery( parsed.terms.mkString(" ") ).fields(searchableFields*).analyzer("english").matchType("most_fields") - must { + boolQuery().filter { matcher :: List( parsed("owner").map(termQuery(Fields.owner, _)), parsed("member").map(member =>