Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法elastic4s从 JSON 字符串构建查询?
elastic4s
例如,类似:
client.execute { "{ \"query\": ..., \"aggs\": ..., ... }" }
在将字符串传递给client.execute. 这是因为 execute 方法包装了 Java 客户端,而 Java 客户端为每个请求类型提供了单独的方法。
client.execute
但是您可以传入原始查询字符串,例如:
search in "*" types("users", "tweets") limit 5 rawQuery { + """{ "prefix": { "bands": { "prefix": "coldplay", "boost": 5.0, "rewrite": "yes" } } }"""