Skip to content

docs(logs): Elasticsearch help examples that work on keyword fields - #124

Open
blue4209211 wants to merge 1 commit into
mainfrom
docs/logs-help-keyword-example
Open

blue4209211 wants to merge 1 commit into
mainfrom
docs/logs-help-keyword-example

Conversation

@blue4209211

Copy link
Copy Markdown
Contributor

Nubi copies the logs query --help examples first. Both Elasticsearch examples used {"match": ...}. On a field mapped as keyword (log on dev account bda8ae12), match compares the whole value and silently returns 0. Nubi then spent dozens of calls finding out why: 49+ calls locally on v0.0.4, and 80+ on dev with the old nbctl.

Changes

  • Both Elasticsearch examples use {"wildcard":{"log":{"value":"*error*","case_insensitive":true}}}, which works on keyword and text fields alike.
  • One added help paragraph: check a field's Type (nbctl logs list-labels --fields-only) before searching it, because match on a keyword field compares the whole value.

Help text only; no behavior change.

Testing

  • make build passes (lint, go test -race ./..., build).
  • Live on dev, Elasticsearch account bda8ae12, 6h window:
    • both old examples return 0 lines;
    • the new lines example returns lines (total ≥ 10,000);
    • the new counts example returns 265 series summing to 170,084, exactly the reported total;
    • list-labels --fields-only shows log as keyword.

🤖 Generated with Claude Code

Nubi copies the logs query --help examples first. Both Elasticsearch
examples used {"match":...}, which on a keyword-mapped field (log on dev
account bda8ae12) compares the whole value and silently returns 0; Nubi
then spent dozens of calls finding out why. The examples now use a
case-insensitive wildcard, which works on keyword and text fields, and the
help says to check a field's Type (list-labels --fields-only) first.
Verified live: the old examples return 0 lines; the new counts example
returns 265 series summing to the exact total (170,084).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the help text and example commands in cmd/logs_query.go for Elasticsearch queries. It adds a note explaining that matching on a keyword field compares the whole value, and updates the examples to use case-insensitive wildcard queries instead of match queries on the log field. There are no review comments, so we have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant