From 8b19308aecc435e001201c07a71151c605a8310e Mon Sep 17 00:00:00 2001 From: Sam Pillsworth Date: Tue, 27 Jul 2021 14:33:53 -0400 Subject: [PATCH] replace refs to deprecated parameters edgeNgram + nGram (#2474) * replace refs to deprecated filters edgeNgram+nGram elasticsearch deprecation notice: https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html#deprecated-ngram-edgengram-token-filter-cannot-be-used * replace Tokenizer ref to deprecated type param elasticsearch deprecation notice: https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.6.html#_disallow_use_of_the_ngram_and_edgengram_tokenizer_names --- .../scala/com/sksamuel/elastic4s/analysis/TokenFilter.scala | 4 ++-- .../scala/com/sksamuel/elastic4s/analysis/Tokenizer.scala | 2 +- .../analysis/tokenizers/EdgeNGramTokenizerBuilderTest.scala | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/analysis/TokenFilter.scala b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/analysis/TokenFilter.scala index 7707f750f..75c57edfd 100644 --- a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/analysis/TokenFilter.scala +++ b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/analysis/TokenFilter.scala @@ -341,7 +341,7 @@ case class EdgeNGramTokenFilter(override val name: String, override def build: XContentBuilder = { val b = XContentFactory.jsonBuilder() - b.field("type", "edgeNGram") + b.field("type", "edge_ngram") b.field("min_gram", minGram) b.field("max_gram", maxGram) side.foreach(b.field("side", _)) @@ -361,7 +361,7 @@ case class NGramTokenFilter(override val name: String, override def build: XContentBuilder = { val b = XContentFactory.jsonBuilder() - b.field("type", "nGram") + b.field("type", "ngram") minGram.foreach(b.field("min_gram", _)) maxGram.foreach(b.field("max_gram", _)) b diff --git a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/analysis/Tokenizer.scala b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/analysis/Tokenizer.scala index bfe7dfc09..1637c7f18 100644 --- a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/analysis/Tokenizer.scala +++ b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/analysis/Tokenizer.scala @@ -104,7 +104,7 @@ case class EdgeNGramTokenizer(override val name: String, override def build: XContentBuilder = { val b = XContentFactory.jsonBuilder() - b.field("type", "edgeNGram") + b.field("type", "edge_ngram") b.field("min_gram", minGram) b.field("max_gram", maxGram) if (tokenChars.nonEmpty) diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/tokenizers/EdgeNGramTokenizerBuilderTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/tokenizers/EdgeNGramTokenizerBuilderTest.scala index 06c5073c2..3fac0d488 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/tokenizers/EdgeNGramTokenizerBuilderTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/tokenizers/EdgeNGramTokenizerBuilderTest.scala @@ -9,7 +9,7 @@ class EdgeNGramTokenizerBuilderTest extends AnyWordSpec with Matchers with Elast "EdgeNGramTokenizer" should { "build json" in { - EdgeNGramTokenizer("testy").minMaxGrams(2, 3).tokenChars("a", "z").build.string shouldBe """{"type":"edgeNGram","min_gram":2,"max_gram":3,"token_chars":["a","z"]}""" + EdgeNGramTokenizer("testy").minMaxGrams(2, 3).tokenChars("a", "z").build.string shouldBe """{"type":"edge_ngram","min_gram":2,"max_gram":3,"token_chars":["a","z"]}""" } } }