Last active
February 3, 2020 07:47
-
-
Save guerbai/2642b46aa2a4c3bb2bace031475687de to your computer and use it in GitHub Desktop.
es查询收集 #ElasticSearch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 0, | |
"aggs": { | |
"path": { | |
"filter": { | |
"bool": { | |
"filter": [ | |
{"term": {"file_type": 150}} | |
] | |
} | |
}, | |
"aggs": { | |
"cnt": { | |
"cardinality": {"field": "file_id"} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 0, | |
"aggs": { | |
"object_id_info": { | |
"filter": { | |
"bool": { | |
"filter": [ | |
{"term": {"object_type": 51}}, | |
{"match_phrase": {"name": "savage"}} | |
] | |
} | |
}, | |
"aggs": { | |
"group_by_object_id": { | |
"terms": { | |
"field": "object_id", | |
"size": 500 | |
}, | |
"aggs": { | |
"review_ids": { | |
"scripted_metric": { | |
"init_script": "state.transactions = []", | |
"map_script": "state.transactions.add(doc['id'].value)", | |
"combine_script": "state.transactions", | |
"reduce_script": "List ids = new ArrayList(); for (i in states) {ids.addAll(i)} return ids" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 0, | |
"aggs": { | |
"path": { | |
"filter": { | |
"bool": { | |
"filter": [] | |
} | |
}, | |
"aggs": { | |
"group_by_privince" : { | |
"terms": { | |
"field": privince, | |
"size": 100 | |
}, | |
"aggs": { | |
"final_price_total": { | |
"sum": { | |
"field": "final_price" | |
} | |
}, | |
"initial_price_total": { | |
"sum": { | |
"field": "initial_price" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 0, | |
"aggs": { | |
"path": { | |
"filter": { | |
"bool": { | |
"filter": [] | |
} | |
}, | |
"aggs": { | |
"group_by_time": { | |
"range": { | |
"field": "end_time", | |
"ranges": [] | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"bool": { | |
"minimum_should_match": "1", | |
"should": [ | |
{ | |
"constant_score": { | |
"boost": 200, | |
"filter": { | |
"match_phrase": { | |
"display_album": { | |
"query": "album1" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"constant_score": { | |
"boost": 10000, | |
"filter": { | |
"term": { | |
"display_album.keyword": "album1" | |
} | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"terms": { | |
"company": [ | |
1124 | |
] | |
} | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment