Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GET myindex/_search?
- {
- "size":0,
- "query": {
- "bool": {
- "must": [
- { "match": {
- "PersonID": "111"
- }},
- { "match": {
- "Month": "5"
- }}
- ]
- } },
- "aggs": {
- "stay_days": {
- "terms" : {
- "field": "Month"
- }
- }
- }
- }
- {
- "size": 0,
- "query": {
- "bool": {
- "must": [
- {
- "match": {
- "PersonID": "111"
- }
- },
- {
- "range": {
- "datetime": {
- "gte": "2017-05-01",
- "lt": "2017-06-01"
- }
- }
- }
- ]
- }
- },
- "aggregations": {
- "my_day_histogram": {
- "date_histogram": {
- "field": "datetime",
- "interval": "1d",
- "min_doc_count": 1
- }
- }
- }
- }
- "aggregations": {
- "my_month_histogram": {
- "date_histogram": {
- "field": "first_timestamp",
- "interval": "1M",
- "min_doc_count": 1
- },
- "aggregations": {
- "my_day_histogram": {
- "date_histogram": {
- "field": "first_timestamp",
- "interval": "1d"
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment