Skip to content

Instantly share code, notes, and snippets.

@kisakyegordon
Last active September 5, 2018 09:52
Show Gist options
  • Save kisakyegordon/4531826f2f2e81a8e2cbfcbbad92e7c6 to your computer and use it in GitHub Desktop.
Save kisakyegordon/4531826f2f2e81a8e2cbfcbbad92e7c6 to your computer and use it in GitHub Desktop.
# 1. Search For Everything
# 2. Search for the most recent published event
# 3. Search for the most recent subscribed event
# 4. Search for events within the last 24hours
# 1. Search for everything.
GET pubsub-registry/_search
{
"query": {
"match_all": {}
}
}
# 2. Search for the most recent published event
GET pubsub-registry/_search
{
"query":{
"match": {
"actionType": "publish"
}
},
"size": 1,
"sort":[
{
"timestamp.keyword": {
"order": "desc"
}
}
]
}
# 3. Search for the most recent subscribed event
GET pubsub-registry/_search
{
"query":{
"match": {
"actionType": "subscribe"
}
},
"size": 1,
"sort":[
{
"timestamp.keyword": {
"order": "desc"
}
}
]
}
}
# 4. Search for events within the last 24hours
GET pubsub-registry/_search
{
"sort": [{
"timestamp.keyword": {
"order": "desc"
}
}],
"query":{
"range":{
"timestamp.keyword": {
"gte": "(now-24h)"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment