Skip to content

Instantly share code, notes, and snippets.

@justinkambic
Last active March 11, 2020 14:29
Show Gist options
  • Save justinkambic/3871200d5c1c5c8f74002ed4a327d8d1 to your computer and use it in GitHub Desktop.
Save justinkambic/3871200d5c1c5c8f74002ed4a327d8d1 to your computer and use it in GitHub Desktop.
es query with spread vs without
// with spread
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"exists": {
"field": "summary"
}
},
{
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"gte": "2020-03-11T14:27:05.689Z",
"lte": "2020-03-11T14:28:25.692Z"
}
}
},
{
"bool": {
"should": [
{
"range": {
"monitor.timespan": {
"gte": "2020-03-11T14:22:46.278Z",
"lte": "2020-03-11T14:27:46.278Z"
}
}
},
{
"bool": {
"must_not": {
"exists": {
"field": "monitor.timespan"
}
}
}
}
]
}
}
]
}
}
]
}
}
}
// without spread
{
"size":0,
"query":{
"bool":{
"filter":[
{
"exists":{
"field":"summary"
}
},
[
{
"bool":{
"filter":[
{
"range":{
"@timestamp":{
"gte":"2020-03-11T14:14:13.526Z",
"lte":"2020-03-11T14:15:33.528Z"
}
}
},
{
"bool":{
"should":[
{
"range":{
"monitor.timespan":{
"gte":"2020-03-11T14:09:54.181Z",
"lte":"2020-03-11T14:14:54.181Z"
}
}
},
{
"bool":{
"must_not":{
"exists":{
"field":"monitor.timespan"
}
}
}
}
]
}
}
]
}
}
]
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment