NAMESPACE, WINDOW, LIMIT
The three optional clauses that scope a query — where it looks, how far back, and how much it returns.
Three optional clauses follow the MATCH expression, in this order:
MATCH DIRECTION(["unmet need", "product frustration"]) CONE 0.4
NAMESPACE "org:retailco-eu", "org:retailco-us", NOT "org:retailco-internal"
WINDOW 30d
LIMIT 50
{
"match": { "direction": { "toward": ["unmet need", "product frustration"], "cone": 0.4 } },
"namespace": {
"include": ["org:retailco-eu", "org:retailco-us"],
"exclude": ["org:retailco-internal"]
},
"window": "P30D",
"limit": 50
}
NAMESPACE
A comma-separated selector deciding which namespaces the query reads. Items may
be quoted names, NOT a quoted name, or the keywords ALL and GLOBAL.
| Field | Type | Default | Description |
|---|---|---|---|
include |
string[] | [] |
Names to include — exact match, no wildcards |
exclude |
string[] | [] |
Names to exclude — exact match, no wildcards |
global |
boolean | false |
Include the well-known global namespace |
all |
boolean | false |
Include every namespace the caller can reach |
There are no wildcards, and the parser says so rather than letting you find
out later. A name containing * is rejected outright:
namespace names do not support wildcards ('*')
Enumerate the names instead.
global and all are independent — either, both or neither may be set, and
both may appear alongside literal names:
MATCH DISTANCE("swamp sighting") NAMESPACE "monsters", GLOBAL
At most 8 includes and 8 excludes fit in a query. See limits.
WINDOW
How far back the query looks.
The text form is a shorthand integer and unit: 30s, 15m, 24h, 7d, 4w.
The JSON form is an ISO 8601 duration: "PT30S", "PT15M", "PT24H", "P7D",
"P28D".
The text parser accepts both spellings. The JSON serializer always emits ISO
8601, so a round trip normalizes 4w to "P28D".
A window must be positive when present:
query: window must be positive
LIMIT
The maximum number of results, as a positive integer:
query: limit must be positive
Whether a host applies LIMIT at all depends on what it is doing with the
query — it has an obvious meaning for a search and much less of one for a
long-lived subscription.
Grammar
namespace_clause = "NAMESPACE" namespace_selector ;
namespace_selector = namespace_item { "," namespace_item } ;
namespace_item = namespace_ref | "ALL" | "GLOBAL" ;
namespace_ref = [ "NOT" ] string_literal ;
window_clause = "WINDOW" duration ;
limit_clause = "LIMIT" integer ;
duration = integer time_unit ;
time_unit = "s" | "m" | "h" | "d" | "w" ;