gpt4 book ai didi

elasticsearch - elastic4s 从 JSON 源构建查询

转载 作者:行者123 更新时间:2023-11-29 02:55:40 25 4
gpt4 key购买 nike

有没有办法在 elastic4s 中构建查询?来自 JSON 字符串?

例如,像这样的东西:

client.execute { "{ \"query\": ..., \"aggs\": ..., ... }" }

最佳答案

在将字符串传递给 client.execute 的意义上,它不支持真正的原始查询。这是因为 execute 方法包装了 Java 客户端,并且 Java 客户端为每种请求类型提供单独的方法。

但是你可以传入一个原始的查询字符串,比如:

search in "*" types("users", "tweets") limit 5 rawQuery {
+ """{ "prefix": { "bands": { "prefix": "coldplay", "boost": 5.0, "rewrite": "yes" } } }"""

关于elasticsearch - elastic4s 从 JSON 源构建查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35273869/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com