Search one entity's content with a regular expression
POST /Platform/entities/{entity_type}/{entity_id}/search
Search one entity's content with a regular expression. Returns the matching lines with their locations.
The search runs server-side over the entity's YAML and returns the
numbered matching lines with locators. It locates text ahead of an
edit/patch, and verifies whether a string is present or absent
in an entity.
pattern is a case-insensitive regular expression. A plain string
works as a literal substring search (regex metacharacters are optional),
so both send_email and \bDr\.\s+\w+ are valid. An absent
string yields an empty match list.
Returns each match with its 1-based view line number AND the JSONPath of
the field it falls in. The JSONPath is exactly the anchor accepted
by edit to scope a non-unique replacement — and it is INDEXED
for matches inside list items ($.fields[20].label), so it converts
directly to a patch JSON Pointer (/fields/20/label) with no
index counting.
Matches also carry locator context, rendered as REAL numbered view lines (never invented text):
heading_path— the enclosing markdown headings (each with its actual view line), for matches inside markdown-bearing fields.item_anchor— the enclosing list item's first line (e.g.- id: item_1) with its view line and indexed path, identifying WHICH element of a list matched.
With logical (default), the pattern is also matched against each
field's unfolded string value, so a phrase that YAML folds across
continuation lines (e.g. a long block-scalar paragraph) still matches
even though it straddles a physical line break. This is the key
advantage over a plain grep of the raw YAML, which would miss such
folded matches (a false negative).
search returns ONLY the matching lines (plus a few context lines) —
never the full field. A whole large text field is read via get
with paths=<field>: the complete field as clean line-numbered text
in one call, numbered with the SAME view coordinates search reports
(single-path reads).
Path parameters
entity_type: str. Entity class name.entity_id: str. Entity ID.
Body parameters
pattern: str. Case-insensitive regular expression. A plain string acts as a literal substring match (metacharacters optional).branch: optional str. Hilus branch (defaultmain).context: optional int. Lines of surrounding context to include per match.logical: optional bool. Also match unfolded field values (default True); set False for raw physical-line grep only.
Returns
EntitySearchResponse
entity_type: optional str or null. Entity class name.entity_id: optional str or null. Entity id.matches: optional List[dict]. One per match: line (view line number), text, jsonpath (indexed field path, usable as an edit anchor), heading_path and item_anchor when present.context: optional List[dict]. Surrounding lines: line, text, is_match.
Example request
curl -X POST "https://api.hilus.ai/Platform/entities/{entity_type}/{entity_id}/search" \
-H "Authorization: Bearer $HILUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'