Skip to content

Commit

Permalink
Implement term query
Browse files Browse the repository at this point in the history
  • Loading branch information
mvelimir committed Dec 12, 2022
1 parent f7531d2 commit d59cecc
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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)))
}
}
}

0 comments on commit d59cecc

Please sign in to comment.