diff --git a/modules/library/src/main/scala/zio/elasticsearch/ElasticQuery.scala b/modules/library/src/main/scala/zio/elasticsearch/ElasticQuery.scala index 1bf615cff..7e98d2cdb 100644 --- a/modules/library/src/main/scala/zio/elasticsearch/ElasticQuery.scala +++ b/modules/library/src/main/scala/zio/elasticsearch/ElasticQuery.scala @@ -21,6 +21,9 @@ object ElasticQuery { def matches(field: String, query: Long): ElasticQuery = Match(field, query) + def term(field: String, query: String): ElasticQuery = + Term(field, query) + def boolQuery(): BoolQuery = BoolQuery.empty private[elasticsearch] final case class BoolQuery(must: List[ElasticQuery], should: List[ElasticQuery]) @@ -51,4 +54,9 @@ object ElasticQuery { } } + private[elasticsearch] final case class Term(field: String, query: String) extends ElasticQuery { + override def asJson: Json = { + Obj("term" -> Obj(field -> Str(query))) + } + } }