Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions connector/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,17 @@ func prepareElasticsearchQuery(ctx context.Context, request *schema.QueryRequest
}
if len(aggs) != 0 {
query["aggs"] = aggs

// set query size to 0 if aggregation is present
// this is because, by default, an aggregation query returns both the aggregation result and the hit documents
// we only want the aggregation result
// more reading: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html#return-only-agg-results
query["size"] = 0
}

// set query size to 0 if aggregation is present
// this is because, by default, an aggregation query returns both the aggregation result and the hit documents
// we only want the aggregation result
// more reading: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html#return-only-agg-results
query["size"] = 0

// set track_total_hits to true if aggregation is present
// this is because, by default, a count query will only return 10,000 hits
query["track_total_hits"] = true
}

span.AddEvent("prepare_filter_query")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
}
}
},
"size": 0
"size": 0,
"track_total_hits": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"*"
]
},
"size": 10000
"size": 0,
"track_total_hits": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
}
}
},
"size": 0
"size": 0,
"track_total_hits": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@
}
}
},
"size": 0
"size": 0,
"track_total_hits": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@
}
}
},
"size": 0
"size": 0,
"track_total_hits": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@
}
}
},
"size": 0
"size": 0,
"track_total_hits": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@
"customer_id": "CUST"
}
},
"size": 0
"size": 0,
"track_total_hits": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
}
}
},
"size": 0
"size": 0,
"track_total_hits": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
}
}
},
"size": 0
"size": 0,
"track_total_hits": true
}