我是Elasticsearch的新手.我阅读了Elasticsearch的Java客户端API,并能够构建查询并通过传输客户端将其发送到Elasticsearch服务器.
因为我的查询对于多级过滤器非常复杂,我注意到通过Java客户端构建查询很麻烦.我觉得构建JSON查询字符串然后通过Java客户端将其发送到Elasticsearch服务器要简单得多.
这是Elasticsearch提供的东西吗?
我喜欢Elasticsearch Java API在收到滚动结果等结果后可以做的事情.我想保留这些功能.
感谢您的任何输入和链接!
问候.
对Elasticsearch API进行了进一步的研究,发现Elasticsearch确实提供了这种功能.方法如下:
SearchResponse scrollResp = client.prepareSearch("my-index") .setTypes("my-type") .setSearchType(SearchType.SCAN) .setQuery(query) // **<-- Query string in JSON format** .execute().actionGet();