WARNING: Version 5.4 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.
flatten_graph token filter accepts an arbitrary graph token
stream, such as that produced by
Synonym Graph Token Filter, and flattens it into a single
linear chain of tokens suitable for indexing.
This is a lossy process, as separate side paths are squashed on top of one another, but it is necessary if you use a graph token stream during indexing because a Lucene index cannot currently represent a graph. For this reason, it’s best to apply graph analyzers only at search time because that preserves the full graph structure and gives correct matches for proximity queries.
For more information on this topic and its various complexities, please read the Lucene’s TokenStreams are actually graphs blog post.