我是scala的新手,正在使用alpakka-elasticsearch客户端执行与elastic search的查询。
单个搜索查询可以通过以下两种方式正常工作,这两种方式在内部调用elastic search的_search url:
val writeCustomIndex = ElasticsearchSource
.typed[Book](
indexName = "source",
typeName = "_doc",
query = """{"match_all": {}}"""
)
或者
val readWithSearchParameters = ElasticsearchSource
.typed[TestDoc](
indexName,
Some(typeName),
searchParams = Map(
"query" -> """ {"match_all": {}} """,
"_source" -> """ ["id", "a", "c"] """
)
我希望你能为我进行以下多重查询(_msearch),并使用此客户端执行。
url - http://localhost:9200/index1/_msearch?
request :
[
{"query" : {"match_all" : {}}, "from" : 0, "size" : 1},
{"index" : "index2"},
{"query" : {"match_all" : {}}, "from" : 0, "size" : 2}
]
弹性客户端源代码:https://doc.akka.io/docs/alpakka/current/elasticsearch.html。