From be577e382d2993ee6d58774de7810e64d65b2b5a Mon Sep 17 00:00:00 2001 From: John Wagster Date: Mon, 3 Mar 2025 14:33:53 -0600 Subject: [PATCH] Update Flatten Graph Docs to Include a Real Flattened Graph 9.x (#123901) updated flatten graph docs to include a real flattened graph --- docs/images/token-graph-dns-synonym-ex2.svg | 2 ++ .../token-graph-dns-synonym-flattened-ex2.svg | 2 ++ .../analysis-flatten-graph-tokenfilter.md | 16 ++++++++-------- 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 docs/images/token-graph-dns-synonym-ex2.svg create mode 100644 docs/images/token-graph-dns-synonym-flattened-ex2.svg diff --git a/docs/images/token-graph-dns-synonym-ex2.svg b/docs/images/token-graph-dns-synonym-ex2.svg new file mode 100644 index 000000000000..4fe42552a3eb --- /dev/null +++ b/docs/images/token-graph-dns-synonym-ex2.svg @@ -0,0 +1,2 @@ +domainnamesystemisfragileinternetphonebook023451 diff --git a/docs/images/token-graph-dns-synonym-flattened-ex2.svg b/docs/images/token-graph-dns-synonym-flattened-ex2.svg new file mode 100644 index 000000000000..b7faa6570ad8 --- /dev/null +++ b/docs/images/token-graph-dns-synonym-flattened-ex2.svg @@ -0,0 +1,2 @@ +domainnamesystemisfragileinternetphonebook01234 diff --git a/docs/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md b/docs/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md index a6f665f6b66f..ada1f1bf8855 100644 --- a/docs/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md +++ b/docs/reference/data-analysis/text-analysis/analysis-flatten-graph-tokenfilter.md @@ -25,7 +25,7 @@ The `flatten_graph` filter uses Lucene’s [FlattenGraphFilter](https://lucene.a To see how the `flatten_graph` filter works, you first need to produce a token graph containing multi-position tokens. -The following [analyze API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-analyze) request uses the `synonym_graph` filter to add `dns` as a multi-position synonym for `domain name system` in the text `domain name system is fragile`: +The following [analyze API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-analyze) request uses the `synonym_graph` filter to add `internet phonebook` as a multi-position synonym for `domain name system` in the text `domain name system is fragile`: ```console GET /_analyze @@ -34,17 +34,17 @@ GET /_analyze "filter": [ { "type": "synonym_graph", - "synonyms": [ "dns, domain name system" ] + "synonyms": [ "internet phonebook, domain name system" ] } ], "text": "domain name system is fragile" } ``` -The filter produces the following token graph with `dns` as a multi-position token. +The filter produces the following token graph with `internet phonebook` as a multi-position token. -:::{image} ../../../images/token-graph-dns-synonym-ex.svg -:alt: token graph dns synonym ex +:::{image} ../../../images/token-graph-dns-synonym-ex2.svg +:alt: token graph dns synonym example ::: Indexing does not support token graphs containing multi-position tokens. To make this token graph suitable for indexing, it needs to be flattened. @@ -58,7 +58,7 @@ GET /_analyze "filter": [ { "type": "synonym_graph", - "synonyms": [ "dns, domain name system" ] + "synonyms": [ "internet phonebook, domain name system" ] }, "flatten_graph" ], @@ -68,8 +68,8 @@ GET /_analyze The filter produces the following flattened token graph, which is suitable for indexing. -:::{image} ../../../images/token-graph-dns-invalid-ex.svg -:alt: token graph dns invalid ex +:::{image} ../../../images/token-graph-dns-synonym-flattened-ex2.svg +:alt: token graph dns flattened example :::