Add ocl index commands for ES reindexing - #8
Open
jamlung-ri wants to merge 1 commit into
Open
Conversation
Introduces `ocl index` command group covering all reindex endpoints available in the OCL API: source-scoped concept/mapping reindex (requires source ownership), collection expansion concept/mapping reindex (admin only), and global ES admin operations (rebuild, populate, batch resource reindex). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
paynejd
requested changes
Aug 25, 2026
paynejd
left a comment
Member
There was a problem hiding this comment.
Thanks @jamlung-ri — this is a genuinely useful addition, and I verified all seven endpoints exist and behave as the code assumes. Worth calling out one thing you got right: correctly separating the JSON endpoints (source index) from the MultiPartParser-only admin endpoints (rebuild/populate/resource) via _post_multipart() — that's easy to get wrong, and the empty-202 handling is correct too.
A few changes before it can go in:
--version→--repo-versiononindex source conceptsandindex source mappings. This repo uses type-specific version flags (--repo-versionfor sources), documented inCLAUDE.md(Conventions) andREADME.md: "Never use a bare--version." Please rename to match the rest of the CLI — that means the Click option, the function parameter, and theversion=argument in the client call.- Update
README.md+docs/demos/. This adds a wholeindexcommand group but touches neither; the repo convention (also inCLAUDE.md) is to update both whenever commands/flags change, so they stay discoverable in the reference. When you do, please flag the global ops (rebuild,populate,resource) as admin-only — they're sysadmin-grade and we'd like that explicit. - Add a smoke test. #10 (just merged) landed a lightweight
CliRunnerpattern intests/test_concept_commands.py; even one delegation test per command group would help here, especially since these kick off expensive/destructive reindex jobs. Theindex resource"no--ids/--uri/--filter→ error" path is a good one to lock down too. - File a tracking ticket in
OpenConceptLab/ocl_issuesand link it. (That per-PR convention wasn't written down in this repo — on us — but we'd like the link going forward.)
The capability itself is the right shape — this is just conventions, docs, and tests before merge. Thanks for building it!
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ocl index source concepts OWNER SOURCEandocl index source mappings OWNER SOURCE— trigger reindexing for a source's concepts or mappings (requires source ownership, not superadmin)ocl index expansion concepts/mappings OWNER COLLECTION VERSION EXPANSION— reindex a collection expansion's resources (admin only)ocl index rebuild,ocl index populate, andocl index resource RESOURCE— admin-level global ES index managementAPI endpoints covered
index source conceptsPOST /{owner_type}/{owner}/sources/{source}/[{version}/]concepts/indexes/index source mappingsPOST /{owner_type}/{owner}/sources/{source}/[{version}/]mappings/indexes/index expansion conceptsPOST /…/expansions/{expansion}/concepts/index/index expansion mappingsPOST /…/expansions/{expansion}/mappings/index/index rebuildPOST /indexes/apps/rebuild/index populatePOST /indexes/apps/populate/index resource RESOURCEPOST /indexes/resources/{resource}/Test plan
ocl index source concepts WHO CIEL— triggers concept reindex, returns task IDocl index source mappings WHO CIEL --version v2025-04-03— scoped to a versionocl index source concepts WHO CIEL --single-batch --no-parallelocl index rebuild— admin token required, returns taskocl index resource concepts --uri /orgs/WHO/— admin batch reindexocl index resource concepts(no filter) — should print usage errorocl index --help,ocl index source --help,ocl index expansion --help🤖 Generated with Claude Code