带有键列表的elastic4s查询文档
elastic4s query document with list of keys
我正在尝试从弹性搜索存储库中检索记录。我的方法是这样的
def findPartialFieldWithId(id: String, path: String): Future[SearchResponse] = {
client.execute {
search in IndexType query {
termQuery("_id", id)
} sourceInclude (path)
}
}
但是如果 id
是一个字符串列表而不是字符串,我应该使用什么 DSL?
试图阅读elastic4s文档和测试用例,但仍然无法正常工作
termsQuery
是要走的路:
def findPartialFieldWithId(ids: Seq[String], path: String): Future[SearchResponse] = {
import scala.collection.JavaConverters._
client.execute {
search in IndexType query {
termsQuery("_id", ids: _* )
} sourceInclude (path)
}
}
我正在尝试从弹性搜索存储库中检索记录。我的方法是这样的
def findPartialFieldWithId(id: String, path: String): Future[SearchResponse] = {
client.execute {
search in IndexType query {
termQuery("_id", id)
} sourceInclude (path)
}
}
但是如果 id
是一个字符串列表而不是字符串,我应该使用什么 DSL?
试图阅读elastic4s文档和测试用例,但仍然无法正常工作
termsQuery
是要走的路:
def findPartialFieldWithId(ids: Seq[String], path: String): Future[SearchResponse] = {
import scala.collection.JavaConverters._
client.execute {
search in IndexType query {
termsQuery("_id", ids: _* )
} sourceInclude (path)
}
}