Skip to content

Instantly share code, notes, and snippets.

@yehosef yehosef/query.json
Last active Nov 22, 2016

Embed
What would you like to do?
elasticsearch avg problem
{
"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"
}
}
}
}
}
}
//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
You can’t perform that action at this time.