我正在使用Elasticsearch,我想写一个查询,以便在查询和分组的基础上获得唯一记录:
SELECT * from users where name='%john%', age='21', location='New York' group by name
你能让我知道如何在elasticsearch with query中编写查询吗?
public class User
{
public string Email { get; set; }
public int Age { get; set; }
public bool Active { get; set; }
}
client.Index(new User { Email ="test@test.te" });
例如,Linq C#中的查询:
rep.Where(user=>user.Email=="test@test.te" && (user.Age>18 || user.Active== t
对于给定的索引,我添加了如下文档:
[
{"expression": "tell me something about elasticsearch"},
{"expression": "this is a new feature for elasticsearch"},
{"expression": "tell me something about kibana"},
# ... and so on
]
现在,我想在给定的输入表达式:"tell me something on elastic
我的SQL查询中有一个WHERE子句,它必须被翻译成elasticsearch bool过滤器。
以下是where条款:
WHERE (
option = "weight" AND value = "50kg"
)
OR (
option = "weight" AND value = "500kg"
)
AND (
option = "magic" AND value = "no"
)
我已经为查询的内部AND编写了和过滤器,但是现在我需要将它们放到bool过滤器中。
试图:
$boolFilter
鉴于以下简单文件:
{
time: 1234545455,
value: 50.6,
unit: 'test'
}
我想找到所有的条目,具有相同的时间戳与条目的某些特定的单位。在伪sql中,我正在查找以下查询:
SELECT * from xyz WHERE time IN (SELECT time from xyz WHERE unit = 'some-unit')
如何在ElasticSearch中做到这一点?
我在Elasticsearch有两个朋友
URI
BROWSER
我想要找到所有那些不是从特定浏览器命中的URI,比如chrome我想要编写以下查询
1. Group by URI,
2. find distinct BROWSER set,
3. filter URIs where chrome is not in BROWERS set.
返回结果。
我已经完成了第一步的查询
{
"aggs": {
"uri_agg": {
"terms": {
"field": "uri.ke