1.查询20151216-17所有的名字
{
"from": 0,
"size": 200,
"query": {
"bool": {
"must": {
"range": {
"DATE": {
"from": 20151216,
"to": 2015121617,
"include_lower": true,
"include_upper": true
}
}
}
}
},
"_source": {
"includes": [
"NAME"
],
"excludes": []
}
2.查询20151217-18所有的名字
{
"from": 0,
"size": 200,
"query": {
"bool": {
"must": {
"range": {
"DATE": {
"from": 20151216,
"to": 2015121617,
"include_lower": true,
"include_upper": true
}
}
}
}
},
"_source": {
"includes": [
"NAME"
],
"excludes": []
}
如果在mysql中可用如下的语句求得这两天name的交集
SELECT NAME FROM Table1 where DATE between 20151216 and 20151217 interset SELECT NAME FROM Table1 where DATE between 20151217 and 20151218
Elastisearch中怎么做呢?
I modified the original poster’s SQL to see if it meets the original poster’s needs. If so, I think the following
elasticsearch
should also be usedelasticsearch
应该也是可以使用的REQUEST:
RESPONSE:
我这里是使用的数据创建时间,查询其价格,因为我的数据中只有价格是重复的,就采用这个做一个测试。
使用 aggs 对数据进行分组,
"size":0
是禁止返回hits
数据,这样直接读取aggregations.my_price.buckets
rrreeeREQUEST:🎜 rrreee 🎜RESPONSE:🎜 rrreee 🎜I am using the data creation time here to query its price. Because only the price is repeated in my data, I will use this as a test.
Use aggs to group data.
"size":0
prohibits returninghits
data, so readaggregations.my_price.buckets
directly. >Attributes are the data sets you need. 🎜I don’t remember this syntax. For NoSQL, all the data found are json style data, and it is very simple and efficient to use a program.