Skip to content

cloud serverless projects search create does not expose body fields (name, region_id) as flags #328

Closed

Description

@MattDevy

Summary

elastic cloud serverless projects search create --help exposes only generic flags (--input-file, --wait, --save-as, --credentials-file, --config-file, --force, --dry-run). The required body fields name and region_id are not available as flags, so creating a project requires writing a JSON file just to set two scalars.

Reproducer

$ elastic cloud serverless projects search create --help
Usage: elastic cloud serverless projects search create [options]

Create an Elasticsearch project

Options:
  --input-file <path>        path to a JSON file to use as command input
  --dry-run                  validate all inputs and exit without performing any action
  --wait                     Wait for the project to reach "initialized" phase before returning
  --save-as <name>           store returned credentials in the OS keychain and upsert a context of this name
  --credentials-file <path>  write credentials to a standalone YAML config fragment at this path (0600)
  --config-file <path>       override the config file written by --save-as
  --force                    overwrite an existing context (--save-as) or file (--credentials-file)
  -h, --help                 display help for command

Current creation flow:

cat > /tmp/body.json <<'EOF'
{ "name": "cli-demo", "region_id": "aws-us-east-1" }
EOF

elastic cloud serverless projects search create \
  --input-file /tmp/body.json --wait --save-as cli-demo

Expected behavior

Expose top-level body fields as flags. At minimum:

elastic cloud serverless projects search create \
  --name cli-demo --region-id aws-us-east-1 --wait --save-as cli-demo

This matches what sister CLIs (gcloud, aws) do, and what users likely expect given the rest of the CLI surface already does this elsewhere (e.g. es indices create --index <name>).

This likely applies to other create endpoints too, including cloud serverless projects observability create and cloud serverless projects security create.

Environment

  • elastic v0.1.1 on macOS

Activity

  1. added
    bug
    on May 18, 2026
  2. added theissue type on May 18, 2026
  3. MattDevy commented on May 19, 2026

    @MattDevy
    ContributorAuthor

    After exploring this, I think the right fix is upstream in elastic/elastic-client-generator-js, not in this repo.

    The generator currently emits cloud API definitions with no body field at all, so buildCommandSchema in src/cloud/register.ts has nothing to register as flags. The same gap affects every POST/PUT/PATCH cloud endpoint, not just these three create commands — deployments create, deployment-templates create, traffic-filters create, organization invitations, etc. all hit the same wall.

    A hand-maintained overlay in this repo (I prototyped one in #351) would fix three endpoints but leaves the rest broken, and AGENTS.md "Lessons Learned" #4 explicitly cautions against this kind of special-casing in generic builders. One change in the generator that maps the OpenAPI request body to body: z.object({...}) solves every endpoint at once with no drift between codegen and overlay.

    Closed #351. Next step is a PR upstream against elastic/elastic-client-generator-js so this and the analogous gaps on the other cloud endpoints all close together.

  4. self-assigned this
    on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions