Last active
November 22, 2016 21:03
-
-
Save yehosef/f96dc491bcd5ee9bf7d3 to your computer and use it in GitHub Desktop.
elasticsearch avg problem
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, | |
"query": { | |
"filtered": { | |
"query": { | |
"query_string": { | |
"query": "*", | |
"analyze_wildcard": true | |
} | |
}, | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"range": { | |
"@timestamp": { | |
"gte": 1402141719395, | |
"lte": 1433677719395 | |
} | |
} | |
} | |
], | |
"must_not": [] | |
} | |
} | |
} | |
}, | |
"aggs": { | |
"2": { | |
"date_histogram": { | |
"field": "@timestamp", | |
"interval": "1w", | |
"pre_zone": "+03:00", | |
"pre_zone_adjust_large_interval": true, | |
"min_doc_count": 1, | |
"extended_bounds": { | |
"min": 1402141719394, | |
"max": 1433677719395 | |
} | |
}, | |
"aggs": { | |
"1": { | |
"avg": { | |
"script": "doc['properties.Page: Number Pageview'].value * 2", | |
"lang": "expression" | |
} | |
}, | |
"4": { | |
"avg": { | |
"field": "properties.Page: Number Pageview" | |
} | |
} | |
} | |
} | |
} | |
} |
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
//PUT _template/logging_default | |
{ | |
"template": "logstash-*", | |
"settings": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0 | |
}, | |
"mappings": { | |
"_default_": { | |
"dynamic_templates": [ | |
{ | |
"notanalyzed": { | |
"match": "*", | |
"match_mapping_type": "string", | |
"mapping": { | |
"index": "not_analyzed", | |
"type": "string", | |
"stored":false, | |
"doc_values": true | |
} | |
} | |
} | |
], | |
"_all": {"enabled": false}, | |
"_source" : {"enabled" : false} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment