Interface ChunkedToXContent
- All Known Subinterfaces:
ChunkedToXContentObject
,ClusterState.Custom
,Metadata.Custom
- All Known Implementing Classes:
BaseNodesXContentResponse
,ChunkedBroadcastResponse
,ClusterRerouteResponse
,ClusterState
,ComponentTemplateMetadata
,ComposableIndexTemplateMetadata
,DataStreamMetadata
,DesiredBalanceResponse
,DesiredNodesMetadata
,Diagnosis
,Diagnosis.Resource
,ElasticsearchNodeCommand.UnknownMetadataCustom
,FeatureMigrationResults
,FieldCapabilitiesResponse
,FieldUsageStatsResponse
,GetHealthAction.Response
,GetIndexResponse
,GetMappingsResponse
,GetSettingsResponse
,GetSnapshotsResponse
,HealthIndicatorResult
,HealthMetadata
,HttpStats
,IndexGraveyard
,IndicesSegmentResponse
,IndicesShardStoresResponse
,IndicesStatsResponse
,IngestMetadata
,IngestStats
,Metadata
,NodeIndicesStats
,NodesShutdownMetadata
,NodesStatsResponse
,NodeStats
,PendingClusterTasksResponse
,PersistentTasksCustomMetadata
,RecoveryResponse
,RepositoriesMetadata
,RepositoryCleanupInProgress
,RestoreInProgress
,ScriptMetadata
,SnapshotDeletionsInProgress
,SnapshotsInProgress
,SnapshotsStatusResponse
,SnapshotStatus
,TransportStats
ToXContent
allowing for progressive serialization by creating an Iterator
of ToXContent
chunks.
The REST layer only serializes enough chunks at once to keep an outbound buffer full, rather than consuming all the time and memory
needed to serialize the entire response as must be done with the regular ToXContent
responses.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChunkedToXContent
AChunkedToXContent
that yields no chunks -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Iterator<? extends ToXContent>
toXContentChunked
(ToXContent.Params params) Create an iterator ofToXContent
chunks for a REST response.default Iterator<? extends ToXContent>
toXContentChunkedV7
(ToXContent.Params params) Create an iterator ofToXContent
chunks for a response to theRestApiVersion.V_7
API.static ToXContent
wrapAsToXContent
(ChunkedToXContent chunkedToXContent) Wraps the given instance in aToXContent
that will fully serialize the instance when serialized.
-
Field Details
-
EMPTY
AChunkedToXContent
that yields no chunks
-
-
Method Details
-
toXContentChunked
Create an iterator ofToXContent
chunks for a REST response. Each chunk is serialized with the sameXContentBuilder
andToXContent.Params
, which is also the same as theToXContent.Params
passed as theparams
argument. For best results, all chunks should beO(1)
size. See alsoChunkedToXContentHelper
for some handy utilities.Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.
- Returns:
- iterator over chunks of
ToXContent
-
toXContentChunkedV7
Create an iterator ofToXContent
chunks for a response to theRestApiVersion.V_7
API. Each chunk is serialized with the sameXContentBuilder
andToXContent.Params
, which is also the same as theToXContent.Params
passed as theparams
argument. For best results, all chunks should beO(1)
size. See alsoChunkedToXContentHelper
for some handy utilities.Similar to
toXContentChunked(org.elasticsearch.xcontent.ToXContent.Params)
but for theRestApiVersion.V_7
API. By default this method delegates totoXContentChunked(org.elasticsearch.xcontent.ToXContent.Params)
.Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.
- Returns:
- iterator over chunks of
ToXContent
-
wrapAsToXContent
Wraps the given instance in aToXContent
that will fully serialize the instance when serialized.- Parameters:
chunkedToXContent
- instance to wrap- Returns:
- x-content instance
-
isFragment
default boolean isFragment()- Returns:
- true iff this instance serializes as a fragment. See
ToXContentObject
for additional details.
-