Class AnonymizationContext
java.lang.Object
org.elasticsearch.xpack.esql.core.anonymizer.AnonymizationContext
Per-query-submission state carried through a single
anonymize() traversal of a plan tree.
Holds the HMAC key (derived from the cluster identifier) plus the token maps that intern each
identifier and literal so a given input maps to the same token across every appearance in the
tree.
Two scopes of stability:
- Column, index, enrich and lookup names get a per-cluster-stable token via
HMAC-SHA256(cluster_uuid, name). Same name on the same cluster yields the same token across queries — useful for cross-incident field-usage telemetry. Disjoint across clusters by construction. - Literals get a per-submission interning id so identity within one query is preserved
(the two
5s inf == 5 AND bar == 5share a token) but the same5gets a fresh token in the next query.
forSubmission(String); reusing
one across submissions would leak literal identity across queries. Used entirely within a single
thread, so its plain HashMap state needs no synchronization.-
Method Summary
Modifier and TypeMethodDescriptionstatic AnonymizationContextforSubmission(String clusterUuid) One context per query submission so literal tokens don't carry across queries.mapper()Returns theNodeStringMapperview backed by this context's state.
-
Method Details
-
forSubmission
One context per query submission so literal tokens don't carry across queries. -
mapper
Returns theNodeStringMapperview backed by this context's state. The mapper is a function — pass it tonodeString/toString. The context holds the lifecycle; the mapper exposes the pure-function surface call sites consume.
-