Created
December 20, 2017 13:15
-
-
Save byronvoorbach/434f84a8cf89f6aab9cb2d9e291a9047 to your computer and use it in GitHub Desktop.
Possible bug when using date_histo icm composite aggregation - Elasticsearch 6.1.1
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
DELETE tickers | |
PUT tickers | |
{ | |
"settings": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0 | |
}, | |
"mappings": { | |
"tickers": { | |
"properties": { | |
"currencyPair": { | |
"type": "text", | |
"fields": { | |
"raw": { | |
"type": "keyword", | |
"ignore_above": 256 | |
} | |
} | |
}, | |
"date": { | |
"type": "date" | |
}, | |
"exchange": { | |
"type": "text", | |
"fields": { | |
"raw": { | |
"type": "keyword", | |
"ignore_above": 256 | |
} | |
} | |
}, | |
"high24hr": { | |
"type": "double" | |
}, | |
"highestBid": { | |
"type": "double" | |
}, | |
"last": { | |
"type": "double" | |
}, | |
"low24hr": { | |
"type": "double" | |
}, | |
"lowestAsk": { | |
"type": "double" | |
}, | |
"percentChange": { | |
"type": "double" | |
}, | |
"quoteVolume": { | |
"type": "double" | |
} | |
} | |
} | |
} | |
} | |
POST tickers/tickers/ | |
{ | |
"date": "2017-12-20T12:19:10.949Z", | |
"percentChange": "-0.06693174", | |
"high24hr": "0.00001549", | |
"currencyPair": "BTC_STR", | |
"last": "0.00001408", | |
"highestBid": "0.00001406", | |
"exchange": "poloniex", | |
"quoteVolume": "243316402.76966244", | |
"lowestAsk": "0.00001408", | |
"low24hr": "0.00001219" | |
} | |
POST tickers/tickers/ | |
{ | |
"date": "2017-12-20T12:19:12.109Z", | |
"percentChange": "-0.06693174", | |
"high24hr": "0.00001549", | |
"currencyPair": "BTC_STR", | |
"last": "0.00001408", | |
"highestBid": "0.00001406", | |
"exchange": "poloniex", | |
"quoteVolume": "243316402.76966244", | |
"lowestAsk": "0.00001408", | |
"low24hr": "0.00001219" | |
} | |
POST tickers/tickers/ | |
{ | |
"date": "2017-12-20T12:19:13.291Z", | |
"percentChange": "-0.06693174", | |
"high24hr": "0.00001549", | |
"currencyPair": "BTC_STR", | |
"last": "0.00001408", | |
"highestBid": "0.00001406", | |
"exchange": "poloniex", | |
"quoteVolume": "243316402.76966244", | |
"lowestAsk": "0.00001408", | |
"low24hr": "0.00001219" | |
} | |
POST tickers/tickers/ | |
{ | |
"date": "2017-12-20T12:19:14.446Z", | |
"percentChange": "-0.06693174", | |
"high24hr": "0.00001549", | |
"currencyPair": "BTC_STR", | |
"last": "0.00001408", | |
"highestBid": "0.00001406", | |
"exchange": "poloniex", | |
"quoteVolume": "243316402.76966244", | |
"lowestAsk": "0.00001408", | |
"low24hr": "0.00001219" | |
} | |
##works | |
GET tickers/_search | |
{ | |
"size": 0, | |
"aggs": { | |
"compos": { | |
"composite": { | |
"size": 50, | |
"sources": [ | |
{ | |
"currencyPair": { | |
"terms": { | |
"field": "currencyPair.raw" | |
} | |
} | |
}, | |
{ | |
"exchanges": { | |
"terms": { | |
"field": "exchange.raw" | |
} | |
} | |
}, | |
{ | |
"time" : { | |
"date_histogram" : { | |
"field": "date", | |
"interval": "5m" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
##doesn't work | |
GET tickers/_search | |
{ | |
"size": 0, | |
"aggs": { | |
"compos": { | |
"composite": { | |
"size": 50, | |
"sources": [ | |
{ | |
"currencyPair": { | |
"terms": { | |
"field": "currencyPair.raw" | |
} | |
} | |
}, | |
{ | |
"exchanges": { | |
"terms": { | |
"field": "exchange.raw" | |
} | |
} | |
}, | |
{ | |
"time" : { | |
"date_histogram" : { | |
"field": "date", | |
"format" : "yyyy-MM-dd--HH:mm:ss.SSSZ", | |
"interval": "5m" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment