Module org.elasticsearch.server
Interface DocumentParsingObserver
- All Superinterfaces:
AutoCloseable
,Closeable
An interface to allow wrapping an XContentParser and observe the events emitted while parsing
A default implementation returns a noop DocumentParsingObserver - does not wrap a XContentParser and
does not do anything upon finishing parsing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DocumentParsingObserver
a default noop implementation -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
An action to be performed upon finished parsing.void
setIndexName
(String indexName) Sets an indexName associated with parsed document.wrapParser
(XContentParser xContentParser) Decorates a provided xContentParser with additional logic (gather some state).
-
Field Details
-
EMPTY_INSTANCE
a default noop implementation
-
-
Method Details
-
wrapParser
Decorates a provided xContentParser with additional logic (gather some state). The Decorator parser should use a state from DocumentParsingObserver in order to perform an action upon finished parsing which will be aware of the state gathered during parsing- Parameters:
xContentParser
- to be decorated- Returns:
- a decorator xContentParser
-
setIndexName
Sets an indexName associated with parsed document.- Parameters:
indexName
- an index name that is associated with the parsed document
-
close
void close()An action to be performed upon finished parsing.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-