1

エラスティック検索リポジトリからレコードを取得しようとしています。そして、私の方法は次のようになります

def findPartialFieldWithId(id: String, path: String): Future[SearchResponse] = {
client.execute {
    search in IndexType query {
    termQuery("_id", id)
    } sourceInclude (path)
}

}

しかし、id文字列ではなく文字列のリストである場合、どの DSL を使用すればよいでしょうか?

Elastic4s のドキュメントとテスト ケースを読み込もうとしましたが、まだ機能しません。

4

1 に答える 1

1

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)
  }
}
于 2015-06-03T11:27:09.457 に答える