函数列表
{
"query": {
"term": {
"title": "blog"
}
}
}
select * from httplogs where title = 'blog';
{
"query": {
"terms": {
"title": [ "blog","page"]
}
}
}
select * from httplogs where title IN ('blog', 'page');
{
"query": {
"match": {
"title": "blog page"
}
}
}
说明:和term区别可以理解为term是精确查询,这边match模糊查询;match会对my ss分词为两个单词,然后term对认为这是一个单词
5. Doris使用示例:
select * from httplogs where request MATCH 'blog page';
{
"bool": {
"should": [
{ "term": { "title": "error" }},
{ "term": { "title": "exption" }} ]
}
}
select * from httplogs where title = 'error' or title = 'exption';
{
"query": {
"bool": {
"must": [
{"match": {
"title": "page"
}},
{
"match": {
"content": "beijing"
}
}
]
}
}
}
select * from httplogs where title MATCH 'title' and content MATCH 'exption';
{
"query": {
"bool": {
"must_not": [
{"match": {
"title": "page"
}},
{
"match": {
"content": "beijing"
}
}
]
}
}
}
select * from httplogs where
!(title MATCH 'title')
and !(content MATCH 'exption');
{
"query": {
"exists": {
"field": "title"
}
}
}
select * from httplogs where title IS NOT NULL;
{
"aggs": {
"hat_prices": { "sum": { "field": "price" } }
}
}
select sum(price) from example_table
{
"size":0,
"aggs": {
"sales": {
"date_histogram": {//按照日期时间聚合分析数据
"field": "event_time",//分组字段
"interval": "1d",//安天分组
"format": "yyyy-MM-dd",//日期格式
"min_doc_count": 0// 没有数据的日志返回0
}
}
}
}
select DAY_FLOOR(event_time) as day
from car group by day;