Fix type and schema mismatches across the spec - #1110
Open
sean- wants to merge 9 commits into
Open
Conversation
sean-
requested review from
Tokesh,
VachaShah,
Xtansia,
aabeshov,
harshavamsi,
karenyrx,
lucy66hw and
sachetalva
as code owners
May 15, 2026 17:04
sean-
force-pushed
the
fix-search-size-int64-to-int32
branch
from
May 19, 2026 06:28
134e175 to
60b80f8
Compare
Several ML fields were typed as int64 but the server uses Java `int` (32-bit). Code generators emit 64-bit integers for these fields, which is wider than the server accepts. Fields fixed (all int64 → int32): - size (×10): _search request bodies and search input schema SearchSourceBuilder.size is Java int, parsed via parser.intValue() - total_chunks (×2): MLRegisterModelMetaInput.totalChunks (Integer) - chunk_number (×2): MLUploadModelChunkInput.chunkNumber (Integer) - num_outputs: AnomalyLocalizationInput.numOutputs (int) Server references (ml-commons be86ad04): - https://github.com/opensearch-project/ml-commons/blob/be86ad045dac49f35d811b74f2928a27536da2a4/common/src/main/java/org/opensearch/ml/common/transport/register/MLRegisterModelMetaInput.java#L81 - https://github.com/opensearch-project/ml-commons/blob/be86ad045dac49f35d811b74f2928a27536da2a4/common/src/main/java/org/opensearch/ml/common/input/execute/anomalylocalization/AnomalyLocalizationInput.java#L148 - https://github.com/opensearch-project/ml-commons/blob/be86ad045dac49f35d811b74f2928a27536da2a4/common/src/main/java/org/opensearch/ml/common/transport/upload_chunk/MLUploadModelChunkInput.java#L32 Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
Query parameters `size`, `startIndex`, and `nearby_findings` were typed as int64 but the server parses all of them with `request.paramAsInt()`, which returns Java `int` (32-bit). Fields fixed (all int64 → int32): - get_alerts: size, startIndex - get_findings: size, startIndex - search_finding_correlations: nearby_findings Server references (security-analytics 4c3d533d): - RestGetAlertsAction.java:41-42 — request.paramAsInt() https://github.com/opensearch-project/security-analytics/blob/4c3d533dd7d71d734f94deb9038fd9b46ae368f2/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetAlertsAction.java#L41-L42 - RestGetFindingsAction.java:41-42 — request.paramAsInt() https://github.com/opensearch-project/security-analytics/blob/4c3d533dd7d71d734f94deb9038fd9b46ae368f2/src/main/java/org/opensearch/securityanalytics/resthandler/RestGetFindingsAction.java#L41-L42 - RestSearchCorrelationAction.java:60 — request.paramAsInt() https://github.com/opensearch-project/security-analytics/blob/4c3d533dd7d71d734f94deb9038fd9b46ae368f2/src/main/java/org/opensearch/securityanalytics/resthandler/RestSearchCorrelationAction.java#L60 Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
Multiple schema files had integer widths or types that don't match the server. Code generators emit incorrect types for these fields. int64 → int32 (server uses Java int): - indices.forcemerge max_num_segments — ForceMergeRequest.java:77 - cluster.stats ClusterStatsIndices.count — int indexCount - cluster.remote_info num_nodes_connected — int numNodesConnected - nodes.stats ThreadCount active/largest/queue/threads — private final int - snapshot file_count — int incrementalFileCount - snapshot SnapshotShardsStats done/failed/finalizing/initializing/started/total — private int - indices.recovery RecoveryFiles recovered/reused/total — return int - indices.stats ShardCommit.num_docs — int numDocs - _common RecoveryStats current_as_source/current_as_target — AtomicInteger - _common RefreshStats.listeners — int listeners int32 → int64 (server uses Java long): - indices.stats ShardCommit.generation — long generation - nodes.info NodeInfoJvmInfo.pid — long pid - nodes.info NodeInfoNetwork.refresh_interval — long refreshInterval - _common SegmentsStats.count — long count integer/int32 → number/double: - cluster.stats ClusterIndicesShards.replication — getReplication() returns double Server references (OpenSearch 27333365): - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/action/admin/indices/forcemerge/ForceMergeRequest.java#L77 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/action/admin/cluster/stats/ClusterStatsIndices.java#L61 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/transport/SniffConnectionStrategy.java#L614 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/threadpool/ThreadPoolStats.java#L67-L71 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/snapshots/SnapshotStats.java#L61-L62 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/snapshots/SnapshotShardsStats.java#L56-L61 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/indices/recovery/ReplicationLuceneIndex.java - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/index/engine/CommitStats.java#L57-L59 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/monitor/jvm/JvmInfo.java#L222 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/monitor/os/OsInfo.java#L50 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/index/recovery/RecoveryStats.java#L55-L56 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/index/refresh/RefreshStats.java#L65 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/index/engine/SegmentsStats.java#L61 Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
int64 → int32 (server uses Java int): - TermSuggestion.Option.freq — int freq in TermSuggestion.java:229 - MultiSearchItem.status — int getStatus() in RestStatus.java - ReindexStatus.batches — int batches in BulkByScrollTask.java:456 int32 → int64 (server uses Java long): - AggregationProfileDebug.total_buckets — bucketOrds.size() returns long - FetchProfileBreakdown (8 fields) — Map<String, Long> in ProfileResult.java:88 - Term.ttf — Lucene TermsEnum.totalTermFreq() returns long number → integer/int64: - MultiSearchResult.took — long tookInMillis in MultiSearchResponse.java:145 number → integer/int32: - MultiSearchItem.status — int getStatus() in RestStatus.java Server references (OpenSearch 27333365): - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/search/suggest/term/TermSuggestion.java#L229 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/search/profile/ProfileResult.java#L88 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/action/search/MultiSearchResponse.java#L145 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/rest/RestStatus.java#L526 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/index/reindex/BulkByScrollTask.java#L456 Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
Eleven integer fields were declared as `type: integer` without a format specifier. The server uses Java `long` for all of them, so they need `format: int64`. Without it, code generators default to int32. Fields fixed (all add format: int64): - created_time, last_updated_time — Instant.toEpochMilli() returns long - total.value — TotalHits.value is long - _version, _seq_no, _primary_term (×6) — long in GetResult.java:87-89 - took (×2) — long tookInMillis in SearchResponse Server references: - flow-framework 30ed527a: https://github.com/opensearch-project/flow-framework/blob/30ed527ae0b121ee7e47db8326d6672ca4d76aa8/src/main/java/org/opensearch/flowframework/model/Template.java - OpenSearch 27333365: https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/index/get/GetResult.java#L87-L89 Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
BUG: HeaderParamsMap.additionalProperties was defined as type: integer / format: int32, but the server declares this field as Map<String, String>. This is not an integer width mismatch — the type is entirely wrong. Code generators emit integer-typed map values where the server sends and expects strings. Field fixed: - HeaderParamsMap additionalProperties: integer/int32 → string Server reference (notifications 690f3df2): - CustomWebhookDestination.kt: Map<String, String> https://github.com/opensearch-project/notifications/blob/690f3df226f2da10da23bb717ff151406be8c436/notifications/core/src/main/kotlin/org/opensearch/notifications/core/setting/PluginSettings.kt Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
Two snapshot path parameters had a schema reference that did not match server behavior. The Name schema accepts a single string; Names is oneOf single-or-array, matching the comma-separated path syntax accepted by Strings.splitStringByCommaToArray. Fields fixed: - snapshot.delete::path.snapshot: Name -> Names Server splits on commas via Strings.splitStringByCommaToArray and stores the result as String[] snapshots. - snapshot.delete_repository::path.repository: Names -> Name (reverse) Server reads a single repository string. Wildcard matching is performed on a single name pattern, not a comma-separated list. Server references (OpenSearch 27333365): - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java#L73 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/action/admin/cluster/snapshots/delete/DeleteSnapshotRequest.java#L58-L71 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java#L70 - https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/action/admin/cluster/repositories/delete/DeleteRepositoryRequest.java#L55-L70 Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
The ingest.get_pipeline {id} path parameter referenced the singular Id
schema, but the server splits the value on commas and treats it as a
list. The parameter description already documents this ("A
comma-separated list of pipeline IDs to retrieve. Wildcard expressions
are supported"), so the singular ref was a long-standing schema bug.
Field fixed:
- ingest.get_pipeline::path.id: Id -> Ids
Server splits on commas via Strings.splitStringByCommaToArray and
passes the resulting array to GetPipelineRequest.
Server reference (OpenSearch 27333365):
- https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/rest/action/ingest/RestGetPipelineAction.java#L71
Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
sean-
force-pushed
the
fix-search-size-int64-to-int32
branch
from
May 22, 2026 09:03
60b80f8 to
e6c670a
Compare
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
Fixes type and schema mismatches across the spec, verified against server source code. Two classes of bug are addressed:
formatspecifier to choose native integer types — wrong formats produce incorrect generated code (e.g.,int64emitslongin Java /int64in Go where the server expectsint).Name/Idschemas where the server splits the value on commas (or vice versa). The singular schemas accept a string;Names/IdsareoneOfsingle-or-array, matching the comma-separated syntax the server actually accepts.All changes were verified by reading the Java/Kotlin server declarations for each field.
Bug fix: notifications
HeaderParamsMaphas wrong type (integer → string)HeaderParamsMap.additionalPropertieswas defined astype: integer, format: int32, but the server declares this asMap<String, String>(CustomWebhookDestination.kt). This is not a width mismatch — the type is entirely wrong. Code generators emit integer-typed map values where the server sends and expects strings.Bug fix: path parameter cardinality (
Name/Id↔Names/Ids)Three path parameters had a schema reference that did not match server behavior. The singular
NameandIdschemas accept a single string;NamesandIdsareoneOfsingle-or-array, matching the comma-separated path syntax accepted byStrings.splitStringByCommaToArray. Code generators emit the wrong type — a single string where the server accepts a list, or a list where the server accepts only a single name.snapshot.delete::path.snapshotNameNamesStrings.splitStringByCommaToArray, stored asString[] snapshots.ingest.get_pipeline::path.idIdIdsStrings.splitStringByCommaToArray.snapshot.delete_repository::path.repositoryNamesName(reverse)Server references (OpenSearch
27333365):RestDeleteSnapshotAction.java#L73—Strings.splitStringByCommaToArray(request.param("snapshot"))DeleteSnapshotRequest.java#L58-L71—private String[] snapshots; public DeleteSnapshotRequest(String repository, String... snapshots)RestGetPipelineAction.java#L71—Strings.splitStringByCommaToArray(restRequest.param("id"))RestDeleteRepositoryAction.java#L70—request.param("repository")(single string)DeleteRepositoryRequest.java#L55-L70—private String nameChanges by area
ML plugin (
ml.yaml,ml._common.yaml) — int64 → int32size(×10):_searchrequest bodies —SearchSourceBuilder.sizeis Javainttotal_chunks(×2),chunk_number(×2): JavaIntegernum_outputs: JavaintSecurity Analytics (
security_analytics.yaml) — int64 → int32size,startIndex(×2 each):request.paramAsInt()in alert and findings handlersnearby_findings:request.paramAsInt()in correlation handlerCore OpenSearch schemas — mixed direction
int64 → int32 (server uses Java
int):indices.forcemergemax_num_segmentscluster.statsClusterStatsIndices.countcluster.remote_infonum_nodes_connectednodes.statsThreadCountactive/largest/queue/threadssnapshotfile_count,SnapshotShardsStats6 fieldsindices.recoveryRecoveryFilesrecovered/reused/totalindices.statsShardCommit.num_docs_commonRecoveryStatscurrent_as_source/current_as_target,RefreshStats.listenersint32 → int64 (server uses Java
long):indices.statsShardCommit.generationnodes.infoNodeInfoJvmInfo.pid,NodeInfoNetwork.refresh_interval_commonSegmentsStats.countinteger/int32 → number/double:
cluster.statsClusterIndicesShards.replicationCore search APIs — mixed direction
int64 → int32:
TermSuggestion.Option.freq,MultiSearchItem.status,ReindexStatus.batchesint32 → int64:
AggregationProfileDebug.total_buckets,FetchProfileBreakdown(8 fields),Term.ttfnumber → integer/int64:
MultiSearchResult.tooknumber → integer/int32:
MultiSearchItem.statusFlow Framework (
flow_framework.common.yaml) — add missing int64 format11
type: integerfields lacked a format specifier. Withoutformat: int64, code generators default to int32, but the server uses Javalong:created_time,last_updated_time—Instant.toEpochMilli()total.value—TotalHits.value_version,_seq_no,_primary_term(×6) —longinGetResult.javatook(×2) —long tookInMillisNotifications (
notifications._common.yaml) — integer → string (bug)HeaderParamsMapadditionalProperties:type: integer, format: int32→type: stringSnapshot and ingest namespaces — path parameter cardinality
snapshot.delete::path.snapshot:Name→Namessnapshot.delete_repository::path.repository:Names→Name(reverse)ingest.get_pipeline::path.id:Id→IdsServer references
All changes verified against these commits:
27333365da0d55a16bea2ebaf34f6f2a691f6d50be86ad045dac49f35d811b74f2928a27536da2a44c3d533dd7d71d734f94deb9038fd9b46ae368f230ed527ae0b121ee7e47db8326d6672ca4d76aa8690f3df226f2da10da23bb717ff151406be8c436By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.