Skip to main content

Limits and gotchas

Sizes​

WhatLimit
Document list: from + size10,000
terms buckets (options.size)Elasticsearch default 10 if omitted. The app uses 3 by default and up to 10,000
Composite sizeDefault 10 if omitted, bounded by the cluster bucket limit (65,535)
Documents per bucket (top_hits)1 to 100
cardinalityExact up to about 40,000 distinct values, then approximate
cardinality_preciseAt most 500 buckets, aggregation mode, all groupings terms
collect_terms100 values by default
filteredDocCountCapped at 10,000 (relation: 'gte')
Rows per aggregationOne response, no paging. Split by filter if you have more than you can handle

Time zones​

  • datetime-interval buckets and datetime-component values are computed in UTC. There is no time zone option. Convert in your code if you need local time.
  • Relative date filters using date math (now-1M/M) are UTC. The Insights app computes them in the browser's zone and sends timestamps.
  • Timestamps as bucket keys are epoch milliseconds.

Empty and missing values​

  • Documents without a value in a grouped field are left out unless you use includeMissing, missingAsFalse or a missing stage.
  • includeMissing on terms adds a bucket with the key missing (aggregation mode) or null (composite mode). Use it on text fields. On numeric or date fields it can fail.
  • boolean without missingAsFalse gives numeric keys 0 and 1 and a bucket with key 0 can be returned as an unnamed row. Use missingAsFalse: true.
  • sum/avg over an empty bucket return 0 or nothing depending on the type. Guard formulas.

Things that are silently ignored​

  • Filter items whose field is not in the source, or that have no value.
  • Groupings and metrics whose field is not in the source (the Insights app drops them, so a saved chart can show fewer series than configured).
  • includeMissingIntervals and interval bounds in composite mode.
  • size in aggregation mode (use options.size per grouping).

Choices you have to make yourself​

  • Top N by a metric: request all groups, sort and cut in code (see Sorting).
  • OR and NOT filters: the app only does AND. Use bool.should or must_not clauses yourself.
  • "Contains" for longer text: the n-gram index handles words up to 20 characters. Use wildcard or match for more.

Errors​

ResponseCause
400 { error: 'query/invalid', errors: [{ message }] }Elasticsearch rejected the query: bad filter clause, a grouping type not allowed in composite mode, a window above 10,000, a text field without .keyword in a sort or terms
500 internal-server-errorMissing aggMode with aggs, empty aggs in composite mode, no top_hits stage in composite mode, an unknown aggregation type, includeFieldTypes without fields, unknown region type
404 source/not-foundUnknown source
403 source/access-forbiddenNot allowed on this source
sdk/aggregate-filter-must-be-array, sdk/aggregate-sort-must-be-arraySDK guards, filter/sort not arrays
Empty rows although data existsComposite mode: the last stage is not named docs. Filter matches nothing. Field name without .keyword

A debugging checklist​

  1. Send the request without aggs first, to check that your filter returns documents.
  2. Check the field names against Source(name).get() (fieldTypes).
  3. For groups: check keywordField names (category.keyword), not category.
  4. Add aggMode. Always.
  5. Log result.filteredDocCount and result.totalDocCount to see whether the filter matches.
  6. Build the same query in the Insights app and compare.