diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 5cd2f6ac0b..e39981521f 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,5 @@ # Initial applied scalafmtAll and scalafmtSbt c1a068b59a36f88401ea646577e4ed61df1e1b4a + +# Scala Steward: Reformat with scalafmt 3.8.5 +fb60074fc43b054aab8aa17c4d5bc87106c7ae9e diff --git a/.github/actions/launch-elasticsearch/action.yml b/.github/actions/launch-elasticsearch/action.yml index e3c078881d..93854cadef 100644 --- a/.github/actions/launch-elasticsearch/action.yml +++ b/.github/actions/launch-elasticsearch/action.yml @@ -7,7 +7,7 @@ runs: - name: 'Launch elastic docker' shell: bash run: | - docker run -d -p 39227:9200 -p 39337:9300 -e "discovery.type=single-node" -v /home/runner/work/elastic4s/elastic4s/elastic4s-tests/src/test/resources/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml docker.elastic.co/elasticsearch/elasticsearch:8.16.1 + docker run -d -p 39227:9200 -p 39337:9300 -e "discovery.type=single-node" -v /home/runner/work/elastic4s/elastic4s/elastic4s-tests/src/test/resources/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml docker.elastic.co/elasticsearch/elasticsearch:8.17.3 - name: 'Wait for cluster to start' shell: bash run: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d47a4c299..a559205fc1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,6 +26,9 @@ jobs: distribution: temurin java-version: 11 + - name: set up sbt + uses: sbt/setup-sbt@v1 + - name: Launch elastic docker uses: ./.github/actions/launch-elasticsearch @@ -46,6 +49,9 @@ jobs: distribution: temurin java-version: 11 + - name: set up sbt + uses: sbt/setup-sbt@v1 + - name: Launch elastic docker uses: ./.github/actions/launch-elasticsearch @@ -66,6 +72,9 @@ jobs: distribution: temurin java-version: 11 + - name: set up sbt + uses: sbt/setup-sbt@v1 + - name: Launch elastic docker uses: ./.github/actions/launch-elasticsearch diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6e1ab3e3d8..e4794b0cc9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,5 +22,8 @@ jobs: distribution: temurin java-version: 11 + - name: set up sbt + uses: sbt/setup-sbt@v1 + - name: run lint run: sbt -v "+scalafmtCheckAll;scalafmtSbtCheck" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b4486f9913..a8da23590f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -22,6 +22,9 @@ jobs: distribution: temurin java-version: 11 + - name: set up sbt + uses: sbt/setup-sbt@v1 + - name: Launch elastic docker uses: ./.github/actions/launch-elasticsearch @@ -43,6 +46,9 @@ jobs: distribution: temurin java-version: 11 + - name: set up sbt + uses: sbt/setup-sbt@v1 + - name: Launch elastic docker uses: ./.github/actions/launch-elasticsearch @@ -64,6 +70,9 @@ jobs: distribution: temurin java-version: 11 + - name: set up sbt + uses: sbt/setup-sbt@v1 + - name: Launch elastic docker uses: ./.github/actions/launch-elasticsearch diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87a6c11d7a..72181b6dec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ jobs: with: distribution: temurin java-version: 11 + - uses: sbt/setup-sbt@v1 - run: sbt ci-release env: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} diff --git a/.scalafmt.conf b/.scalafmt.conf index 7a6097704f..6a4c5fa968 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.8.3 +version = 3.9.4 align.preset = most literals.double = Upper diff --git a/README.md b/README.md index 98ef6d4839..fd910eab8d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # elastic4s - Elasticsearch Scala Client [![build](https://github.com/Philippus/elastic4s/workflows/build/badge.svg)](https://github.com/Philippus/elastic4s/actions/workflows/build.yml?query=workflow%3Abuild+branch%3Amain) -![Current Version](https://img.shields.io/badge/version-8.16.0-brightgreen.svg?style=flat "8.16.0") +![Current Version](https://img.shields.io/badge/version-8.17.0-brightgreen.svg?style=flat "8.17.0") [![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat "Apache 2.0")](LICENSE) @@ -35,7 +35,8 @@ Note that starting from versions 7.17.25 and 8.12.0 the group id has changed fro | Elastic Version | Scala 2.12 | Scala 2.13 | Scala 3 | |-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| 8.16.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_3) | +| 8.17.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_3) | +| 8.16.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_3) | | 8.15.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_3) | | 8.14.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_3) | | 8.13.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_3) | @@ -53,25 +54,8 @@ Note that starting from versions 7.17.25 and 8.12.0 the group id has changed fro | 8.1.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | | 8.0.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | | 7.17.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.16.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.15.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.14.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.13.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.12.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.11.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.10.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.9.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.8.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.7.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.6.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.5.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.4.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.3.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.2.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.1.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | -| 7.0.x | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.12%22) | [](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22elastic4s-core_2.13%22) | - -For releases prior to 7.0 [search maven central](https://search.maven.org/search?q=elastic4s). + +For releases prior to 7.17.x [search maven central](https://search.maven.org/search?q=elastic4s). ## Quick Start diff --git a/build.sbt b/build.sbt index d2b0b13272..ce57607f7f 100644 --- a/build.sbt +++ b/build.sbt @@ -15,8 +15,8 @@ def isRelease = releaseVersion != "" // set by github actions and used as the snapshot build number def githubRunNumber = sys.env.getOrElse("GITHUB_RUN_NUMBER", "local") -val scala2Versions = Seq("2.12.20", "2.13.15") -val scalaAllVersions = scala2Versions :+ "3.3.4" +val scala2Versions = Seq("2.12.20", "2.13.16") +val scalaAllVersions = scala2Versions :+ "3.3.5" lazy val commonScalaVersionSettings = Seq( scalaVersion := "2.12.20", @@ -371,9 +371,9 @@ lazy val tests = (project in file("elastic4s-tests")) "org.scala-lang", "scala-library" ), - "org.apache.logging.log4j" % "log4j-api" % "2.24.2" % Test, - "org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.24.2" % Test, - "org.apache.logging.log4j" % "log4j-core" % "2.24.2" % Test + "org.apache.logging.log4j" % "log4j-api" % "2.24.3" % Test, + "org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.24.3" % Test, + "org.apache.logging.log4j" % "log4j-core" % "2.24.3" % Test ), Test / fork := false, Test / parallelExecution := false, diff --git a/docker-compose.yml b/docker-compose.yml index 8142f06a89..298c895b03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:8.16.1 + image: docker.elastic.co/elasticsearch/elasticsearch:8.17.3 environment: discovery.type: single-node network.host: 0.0.0.0 diff --git a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/ScriptBuilderFnTest.scala b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/ScriptBuilderFnTest.scala index 5518505815..bd76edc9be 100755 --- a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/ScriptBuilderFnTest.scala +++ b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/ScriptBuilderFnTest.scala @@ -9,7 +9,10 @@ import org.scalatest.matchers.should.Matchers class ScriptBuilderFnTest extends AnyFunSuite with Matchers { test("should handle recursive maps") { - ScriptBuilderFn(Script("myscript", params = Map("a" -> 1.2, "b" -> Map("c" -> true, "d" -> List(Map("e" -> 3)))))).string shouldBe + ScriptBuilderFn(Script( + "myscript", + params = Map("a" -> 1.2, "b" -> Map("c" -> true, "d" -> List(Map("e" -> 3)))) + )).string shouldBe """{"source":"myscript","params":{"a":1.2,"b":{"c":true,"d":[{"e":3}]}}}""" } diff --git a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/SourceAsContentBuilderTest.scala b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/SourceAsContentBuilderTest.scala index 6635c2c2cc..492e3d9603 100644 --- a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/SourceAsContentBuilderTest.scala +++ b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/SourceAsContentBuilderTest.scala @@ -8,7 +8,9 @@ class SourceAsContentBuilderTest extends AnyFunSuite with Matchers { test("source as content builder should handle tuples") { val map = Map("name" -> "sammy", "teams" -> Seq(("football", "boro"), ("baseball", "phillies")), "projects" -> null) - SourceAsContentBuilder(map).string shouldBe """{"name":"sammy","teams":[["football","boro"],["baseball","phillies"]],"projects":null}""" + SourceAsContentBuilder( + map + ).string shouldBe """{"name":"sammy","teams":[["football","boro"],["baseball","phillies"]],"projects":null}""" } test("source as content builder should handle bigdecimals") { diff --git a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/analysis/NormalizerBuilderTest.scala b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/analysis/NormalizerBuilderTest.scala index e9b1f0dd0f..3767daa90b 100644 --- a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/analysis/NormalizerBuilderTest.scala +++ b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/analysis/NormalizerBuilderTest.scala @@ -7,6 +7,8 @@ class NormalizerBuilderTest extends AnyFunSuite with Matchers { test("should build normalizer to spec") { val n = CustomNormalizer("my_normalizer", List("quote"), List("lowercase", "asciifolding")) - NormalizerBuilder.build(n).string shouldBe """{"type":"custom","filter":["lowercase","asciifolding"],"char_filter":["quote"]}""" + NormalizerBuilder.build( + n + ).string shouldBe """{"type":"custom","filter":["lowercase","asciifolding"],"char_filter":["quote"]}""" } } diff --git a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/indexes/UpdateIndexLevelSettingsBuilderTest.scala b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/indexes/UpdateIndexLevelSettingsBuilderTest.scala index 4e7d881e12..e66ba587d6 100644 --- a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/indexes/UpdateIndexLevelSettingsBuilderTest.scala +++ b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/indexes/UpdateIndexLevelSettingsBuilderTest.scala @@ -43,6 +43,8 @@ class UpdateIndexLevelSettingsBuilderTest extends AnyFunSuite with Matchers { settings = Map("index.blocks.write" -> true.toString) ) - UpdateIndexLevelSettingsBuilder(definition).string shouldBe """{"settings":{"index.blocks.write":"true","index.number_of_replicas":0}}""" + UpdateIndexLevelSettingsBuilder( + definition + ).string shouldBe """{"settings":{"index.blocks.write":"true","index.number_of_replicas":0}}""" } } diff --git a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/MultiSearchBuilderFnTest.scala b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/MultiSearchBuilderFnTest.scala index 3b5416fecc..cea9d35637 100644 --- a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/MultiSearchBuilderFnTest.scala +++ b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/MultiSearchBuilderFnTest.scala @@ -20,7 +20,9 @@ class MultiSearchBuilderFnTest extends AnyWordSpec with Matchers { } "build multisearch request with ignore_unavailable indices option" in { val req = searchRequest indicesOptions IndicesOptionsRequest(ignoreUnavailable = true) - MultiSearchBuilderFn(multi(req)).linesIterator.next shouldBe """{"index":"someIndex","ignore_unavailable":"true"}""" + MultiSearchBuilderFn( + multi(req) + ).linesIterator.next shouldBe """{"index":"someIndex","ignore_unavailable":"true"}""" } } diff --git a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/queries/IntervalsQueryBuilderFnTest.scala b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/queries/IntervalsQueryBuilderFnTest.scala index 21ea4c9005..881376c51b 100644 --- a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/queries/IntervalsQueryBuilderFnTest.scala +++ b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/queries/IntervalsQueryBuilderFnTest.scala @@ -188,4 +188,58 @@ class IntervalsQueryBuilderFnTest extends AnyFunSuite with Matchers with GivenWh Then("query should have right fields") queryBody.string should matchJson(expected) } + + test("Should correctly build intervals boosted query") { + Given("An intervals query with boost set") + val query = IntervalsQuery( + "my_text", + AllOf(List( + Match(query = "my favorite food").maxGaps(0).ordered(true), + AnyOf(intervals = + List( + Match(query = "hot water"), + Match(query = "cold porridge") + ) + ) + )).ordered(true), + Some(2.5D) + ) + + When("Intervals query is built") + val queryBody = IntervalsQueryBuilderFn(query) + + Then("query should have right fields and boost set") + queryBody.string should matchJson(intervalsBoostedQuery) + } + + def intervalsBoostedQuery: String = + """ + |{ + | "intervals" : { + | "my_text" : { + | "boost": 2.5, + | "all_of" : { + | "ordered" : true, + | "intervals" : [ + | { + | "match" : { + | "query" : "my favorite food", + | "max_gaps" : 0, + | "ordered" : true + | } + | }, + | { + | "any_of" : { + | "intervals" : [ + | { "match" : { "query" : "hot water" } }, + | { "match" : { "query" : "cold porridge" } } + | ] + | } + | } + | ] + | } + | } + | } + |} + """.stripMargin.replace("\n", "") } diff --git a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/ext/Maps.scala b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/ext/Maps.scala index 46a7b05b96..2b4293a5a8 100644 --- a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/ext/Maps.scala +++ b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/ext/Maps.scala @@ -12,6 +12,7 @@ object Maps { case (key, value: java.util.Map[String, V]) => flatten(value.asScala.toMap[String, V]).map { case (k, v) => s"$key$separator$k" -> v } + case (key, null) => Map(key -> null.asInstanceOf[V]) case (key, value: V) => Map(key -> value) } diff --git a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/SearchResponse.scala b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/SearchResponse.scala index 79a0e3de27..b7efc9f2d3 100644 --- a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/SearchResponse.scala +++ b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/SearchResponse.scala @@ -22,6 +22,7 @@ case class SearchResponse( private val suggest: Map[String, Seq[SuggestionResult]], @JsonProperty("_shards") private val _shards: Shards, @JsonProperty("_scroll_id") scrollId: Option[String], + @JsonProperty("pit_id") pitId: Option[String], @JsonProperty("aggregations") private val _aggregationsAsMap: Map[String, Any], hits: SearchHits ) { diff --git a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/queries/IntervalsQuery.scala b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/queries/IntervalsQuery.scala index bea4cd1db0..fb966b7bd5 100644 --- a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/queries/IntervalsQuery.scala +++ b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/queries/IntervalsQuery.scala @@ -3,7 +3,7 @@ package com.sksamuel.elastic4s.requests.searches.queries import com.sksamuel.elastic4s.requests.script.Script import com.sksamuel.elastic4s.ext.OptionImplicits._ -case class IntervalsQuery(field: String, rule: IntervalsRule) extends Query +case class IntervalsQuery(field: String, rule: IntervalsRule, boost: Option[Double] = None) extends Query sealed trait IntervalsRule case class Match( diff --git a/elastic4s-domain/src/test/scala/com/sksamuel/elastic4s/MapsTest.scala b/elastic4s-domain/src/test/scala/com/sksamuel/elastic4s/MapsTest.scala new file mode 100644 index 0000000000..2281b5d44e --- /dev/null +++ b/elastic4s-domain/src/test/scala/com/sksamuel/elastic4s/MapsTest.scala @@ -0,0 +1,58 @@ +package com.sksamuel.elastic4s + +import com.sksamuel.elastic4s.ext.Maps +import org.scalatest +import org.scalatest.matchers.should.Matchers + +class MapsTest extends scalatest.flatspec.AnyFlatSpec with Matchers { + "Maps flatten function" should "support null values" in { + val jsonMap: Map[String, Any] = Map( + "settings" -> Map( + "index" -> Map( + "routing" -> Map( + "allocation" -> Map( + "include" -> Map( + "_tier_preference" -> "data_content" + ), + "initial_recovery" -> Map( + "_id" -> null + ) + ) + ), + "number_of_shards" -> "1", + "routing_partition_size" -> "1", + "blocks" -> Map( + "write" -> "true" + ), + "provided_name" -> "test-two", + "resize" -> Map( + "source" -> Map( + "name" -> "test-index", + "uuid" -> "1234" + ) + ), + "creation_date" -> "1234", + "number_of_replicas" -> "1", + "uuid" -> "1234", + "version" -> Map( + "created" -> "1234" + ) + ) + ) + ) + Maps.flatten(jsonMap) shouldBe Map( + "settings.index.resize.source.name" -> "test-index", + "settings.index.resize.source.uuid" -> "1234", + "settings.index.provided_name" -> "test-two", + "settings.index.blocks.write" -> "true", + "settings.index.routing_partition_size" -> "1", + "settings.index.routing.allocation.include._tier_preference" -> "data_content", + "settings.index.routing.allocation.initial_recovery._id" -> null, + "settings.index.number_of_replicas" -> "1", + "settings.index.version.created" -> "1234", + "settings.index.number_of_shards" -> "1", + "settings.index.creation_date" -> "1234", + "settings.index.uuid" -> "1234" + ) + } +} diff --git a/elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/IntervalsQueryBuilderFn.scala b/elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/IntervalsQueryBuilderFn.scala index c47ac28f7d..110e5a0ff5 100644 --- a/elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/IntervalsQueryBuilderFn.scala +++ b/elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/IntervalsQueryBuilderFn.scala @@ -143,7 +143,13 @@ object IntervalsQueryBuilderFn { def apply(q: IntervalsQuery): XContentBuilder = { val builder = XContentFactory.jsonBuilder() builder.startObject("intervals") - builder.rawField(q.field, IntervalsRuleBuilderFn(q.rule)) + builder.rawField( + q.field, { + val ruleBuilder = IntervalsRuleBuilderFn(q.rule) + q.boost.foreach(ruleBuilder.field("boost", _)) + ruleBuilder + } + ) builder.endObject() } } diff --git a/elastic4s-tests/src/test/resources/json/search/search_numeric_filter.json b/elastic4s-tests/src/test/resources/json/search/search_numeric_filter.json deleted file mode 100644 index 08151249ad..0000000000 --- a/elastic4s-tests/src/test/resources/json/search/search_numeric_filter.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "post_filter": { - "numeric_range": { - "years": { - "from": 1900, - "to": 2100, - "include_lower": true, - "include_upper": true - }, - "_cache": true, - "_cache_key": "key" - } - } -} diff --git a/elastic4s-tests/src/test/resources/json/search/search_numeric_filter2.json b/elastic4s-tests/src/test/resources/json/search/search_numeric_filter2.json deleted file mode 100644 index effb2bcab0..0000000000 --- a/elastic4s-tests/src/test/resources/json/search/search_numeric_filter2.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "post_filter": { - "numeric_range": { - "years": { - "from": 12.4, - "to": 45.5, - "include_lower": true, - "include_upper": true - }, - "_cache": true, - "_cache_key": "key" - } - } -} diff --git a/elastic4s-tests/src/test/resources/json/search/search_numeric_filter3.json b/elastic4s-tests/src/test/resources/json/search/search_numeric_filter3.json deleted file mode 100644 index 1c2874803a..0000000000 --- a/elastic4s-tests/src/test/resources/json/search/search_numeric_filter3.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "post_filter": { - "numeric_range": { - "years": { - "from": "12.4", - "to": "45.5", - "include_lower": false, - "include_upper": false - }, - "_name": "superfilter", - "_cache": true, - "_cache_key": "key" - } - } -} diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/analyzers/FingerprintAnalyzerBuilderTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/analyzers/FingerprintAnalyzerBuilderTest.scala index 87487b3b20..18190ddaf2 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/analyzers/FingerprintAnalyzerBuilderTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/analyzers/FingerprintAnalyzerBuilderTest.scala @@ -8,7 +8,10 @@ class FingerprintAnalyzerBuilderTest extends AnyWordSpec with Matchers { "FingerprintAnalyzer" should { "build json" in { - FingerprintAnalyzer("testy").separator("-").maxOutputSize(123).stopwords("a", "z").build.string shouldBe """{"type":"fingerprint","separator":"-","stopwords":["a","z"],"max_output_size":123}""" + FingerprintAnalyzer("testy").separator("-").maxOutputSize(123).stopwords( + "a", + "z" + ).build.string shouldBe """{"type":"fingerprint","separator":"-","stopwords":["a","z"],"max_output_size":123}""" } } } diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/analyzers/PatternAnalyzerBuilderTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/analyzers/PatternAnalyzerBuilderTest.scala index c0613e95e3..56d4413b91 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/analyzers/PatternAnalyzerBuilderTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/analysis/analyzers/PatternAnalyzerBuilderTest.scala @@ -8,7 +8,10 @@ class PatternAnalyzerBuilderTest extends AnyWordSpec with Matchers { "PatternAnalyzer" should { "build json" in { - PatternAnalyzer("testy", regex = "21.*").lowercase(true).build.string shouldBe """{"type":"pattern","lowercase":true,"pattern":"21.*"}""" + PatternAnalyzer( + "testy", + regex = "21.*" + ).lowercase(true).build.string shouldBe """{"type":"pattern","lowercase":true,"pattern":"21.*"}""" } } } 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 3fac0d4887..d56eabd598 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,10 @@ 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":"edge_ngram","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"]}""" } } } diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/json/XContentBuilderTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/json/XContentBuilderTest.scala index 1f3af86592..fb844eb973 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/json/XContentBuilderTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/json/XContentBuilderTest.scala @@ -26,15 +26,23 @@ class XContentBuilderTest extends AnyFunSuite with Matchers { } test("should support raw fields in objects") { - XContentFactory.obj().rawField("nested", """{"test":true,"name":"foo"}""").string shouldBe """{"nested":{"test":true,"name":"foo"}}""" + XContentFactory.obj().rawField( + "nested", + """{"test":true,"name":"foo"}""" + ).string shouldBe """{"nested":{"test":true,"name":"foo"}}""" } test("should support raw values in arrays") { - XContentFactory.array().rawValue("""{"test":true,"name":"foo"}""").string shouldBe """[{"test":true,"name":"foo"}]""" + XContentFactory.array().rawValue( + """{"test":true,"name":"foo"}""" + ).string shouldBe """[{"test":true,"name":"foo"}]""" } test("should support boolean arrays") { - XContentFactory.obj().array("booleans", Array(true, false, true)).string shouldBe """{"booleans":[true,false,true]}""" + XContentFactory.obj().array( + "booleans", + Array(true, false, true) + ).string shouldBe """{"booleans":[true,false,true]}""" } test("should support double arrays") { @@ -42,11 +50,17 @@ class XContentBuilderTest extends AnyFunSuite with Matchers { } test("should support biginteger arrays") { - XContentFactory.obj().autoarray("bigintegers", Seq(new BigInteger("123"), new BigInteger("456"))).string shouldBe """{"bigintegers":[123,456]}""" + XContentFactory.obj().autoarray( + "bigintegers", + Seq(new BigInteger("123"), new BigInteger("456")) + ).string shouldBe """{"bigintegers":[123,456]}""" } test("should support long arrays") { - XContentFactory.obj().array("longs", Array(345345435345L, 3257059014L)).string shouldBe """{"longs":[345345435345,3257059014]}""" + XContentFactory.obj().array( + "longs", + Array(345345435345L, 3257059014L) + ).string shouldBe """{"longs":[345345435345,3257059014]}""" } test("should support string arrays") { @@ -58,15 +72,24 @@ class XContentBuilderTest extends AnyFunSuite with Matchers { } test("should support bigdecimal fields") { - XContentFactory.obj().field("dec", BigDecimal("291839123.12321312")).string shouldBe """{"dec":291839123.12321312}""" + XContentFactory.obj().field( + "dec", + BigDecimal("291839123.12321312") + ).string shouldBe """{"dec":291839123.12321312}""" } test("should support bigint fields") { - XContentFactory.obj().field("bigint", BigInt("98123981231982361893619")).string shouldBe """{"bigint":98123981231982361893619}""" + XContentFactory.obj().field( + "bigint", + BigInt("98123981231982361893619") + ).string shouldBe """{"bigint":98123981231982361893619}""" } test("should support biginteger fields") { - XContentFactory.obj().autofield("biginteger", new BigInteger("98123981231982361893619")).string shouldBe """{"biginteger":98123981231982361893619}""" + XContentFactory.obj().autofield( + "biginteger", + new BigInteger("98123981231982361893619") + ).string shouldBe """{"biginteger":98123981231982361893619}""" } test("should support iterable fields") { diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/CompoundWordTokenFilterTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/CompoundWordTokenFilterTest.scala index 14656f0adc..13214bf491 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/CompoundWordTokenFilterTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/CompoundWordTokenFilterTest.scala @@ -8,28 +8,50 @@ class CompoundWordTokenFilterTest extends AnyWordSpec with TokenFilterApi with M "CompoundWordTokenFilter builder" should { "set type" in { - compoundWordTokenFilter("testy", DictionaryDecompounder).json.string shouldBe """{"type":"dictionary_decompounder"}""" + compoundWordTokenFilter( + "testy", + DictionaryDecompounder + ).json.string shouldBe """{"type":"dictionary_decompounder"}""" } "set word list" in { - compoundWordTokenFilter("testy", HyphenationDecompounder).wordList("boo", "foo").json.string shouldBe """{"type":"hyphenation_decompounder","word_list":["boo","foo"]}""" + compoundWordTokenFilter( + "testy", + HyphenationDecompounder + ).wordList("boo", "foo").json.string shouldBe """{"type":"hyphenation_decompounder","word_list":["boo","foo"]}""" } "set word list path" in { - compoundWordTokenFilter("testy", HyphenationDecompounder).wordListPath("config/word.txt").json.string shouldBe """{"type":"hyphenation_decompounder","word_list_path":"config/word.txt"}""" + compoundWordTokenFilter("testy", HyphenationDecompounder).wordListPath( + "config/word.txt" + ).json.string shouldBe """{"type":"hyphenation_decompounder","word_list_path":"config/word.txt"}""" } "set hyphenation patterns path" in { - compoundWordTokenFilter("testy", HyphenationDecompounder).wordListPath("config/hyphens.txt").json.string shouldBe """{"type":"hyphenation_decompounder","word_list_path":"config/hyphens.txt"}""" + compoundWordTokenFilter("testy", HyphenationDecompounder).wordListPath( + "config/hyphens.txt" + ).json.string shouldBe """{"type":"hyphenation_decompounder","word_list_path":"config/hyphens.txt"}""" } "set min word size" in { - compoundWordTokenFilter("testy", HyphenationDecompounder).minWordSize(7).json.string shouldBe """{"type":"hyphenation_decompounder","min_word_size":7}""" + compoundWordTokenFilter( + "testy", + HyphenationDecompounder + ).minWordSize(7).json.string shouldBe """{"type":"hyphenation_decompounder","min_word_size":7}""" } "set min subword size" in { - compoundWordTokenFilter("testy", HyphenationDecompounder).minSubwordSize(3).json.string shouldBe """{"type":"hyphenation_decompounder","min_subword_size":3}""" + compoundWordTokenFilter( + "testy", + HyphenationDecompounder + ).minSubwordSize(3).json.string shouldBe """{"type":"hyphenation_decompounder","min_subword_size":3}""" } "set max subword size" in { - compoundWordTokenFilter("testy", HyphenationDecompounder).maxSubwordSize(18).json.string shouldBe """{"type":"hyphenation_decompounder","max_subword_size":18}""" + compoundWordTokenFilter( + "testy", + HyphenationDecompounder + ).maxSubwordSize(18).json.string shouldBe """{"type":"hyphenation_decompounder","max_subword_size":18}""" } "set only longest match" in { - compoundWordTokenFilter("testy", HyphenationDecompounder).onlyLongestMatch(true).json.string shouldBe """{"type":"hyphenation_decompounder","only_longest_match":true}""" + compoundWordTokenFilter( + "testy", + HyphenationDecompounder + ).onlyLongestMatch(true).json.string shouldBe """{"type":"hyphenation_decompounder","only_longest_match":true}""" } } } diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/EdgeNGramTokenizerTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/EdgeNGramTokenizerTest.scala index 29b1e192f1..e2b5d74c1e 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/EdgeNGramTokenizerTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/EdgeNGramTokenizerTest.scala @@ -8,7 +8,10 @@ class EdgeNGramTokenizerTest extends AnyWordSpec with TokenizerApi with Matchers "EdgeNGramTokenizer builder" should { "set min and max ngrams" in { - edgeNGramTokenizer("testy").minMaxGrams(3, 4).json.string shouldBe """{"type":"edgeNGram","min_gram":3,"max_gram":4}""" + edgeNGramTokenizer("testy").minMaxGrams( + 3, + 4 + ).json.string shouldBe """{"type":"edgeNGram","min_gram":3,"max_gram":4}""" } "set token chars" in { edgeNGramTokenizer("testy") diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/KeywordMarkerTokenFilterTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/KeywordMarkerTokenFilterTest.scala index ac2be4c534..611bd88b99 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/KeywordMarkerTokenFilterTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/KeywordMarkerTokenFilterTest.scala @@ -11,16 +11,25 @@ class KeywordMarkerTokenFilterTest extends AnyWordSpec with TokenFilterApi with keywordMarkerTokenFilter("testy").json.string shouldBe """{"type":"keyword_marker"}""" } "set keywords" in { - keywordMarkerTokenFilter("testy").keywords("foo", "bar").json.string shouldBe """{"type":"keyword_marker","keywords":["foo","bar"]}""" + keywordMarkerTokenFilter("testy").keywords( + "foo", + "bar" + ).json.string shouldBe """{"type":"keyword_marker","keywords":["foo","bar"]}""" } "set keywords path" in { - keywordMarkerTokenFilter("testy").keywordsPath("config/keywords.txt").json.string shouldBe """{"type":"keyword_marker","keywords_path":"config/keywords.txt"}""" + keywordMarkerTokenFilter("testy").keywordsPath( + "config/keywords.txt" + ).json.string shouldBe """{"type":"keyword_marker","keywords_path":"config/keywords.txt"}""" } "set keywords pattern" in { - keywordMarkerTokenFilter("testy").keywordsPattern("pattern").json.string shouldBe """{"type":"keyword_marker","keywords_pattern":"pattern"}""" + keywordMarkerTokenFilter( + "testy" + ).keywordsPattern("pattern").json.string shouldBe """{"type":"keyword_marker","keywords_pattern":"pattern"}""" } "set ignore case" in { - keywordMarkerTokenFilter("testy").ignoreCase(true).json.string shouldBe """{"type":"keyword_marker","ignore_case":true}""" + keywordMarkerTokenFilter( + "testy" + ).ignoreCase(true).json.string shouldBe """{"type":"keyword_marker","ignore_case":true}""" } } } diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/LimitTokenCountTokenFilterTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/LimitTokenCountTokenFilterTest.scala index 198ee7e970..eab8544b89 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/LimitTokenCountTokenFilterTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/LimitTokenCountTokenFilterTest.scala @@ -11,10 +11,14 @@ class LimitTokenCountTokenFilterTest extends AnyWordSpec with TokenFilterApi wit limitTokenCountTokenFilter("testy").json.string shouldBe """{"type":"limit"}""" } "set max token count" in { - limitTokenCountTokenFilter("testy").maxTokenCount(7).json.string shouldBe """{"type":"limit","max_token_count":7}""" + limitTokenCountTokenFilter( + "testy" + ).maxTokenCount(7).json.string shouldBe """{"type":"limit","max_token_count":7}""" } "set consume all tokens" in { - limitTokenCountTokenFilter("testy").consumeAllTokens(true).json.string shouldBe """{"type":"limit","consume_all_tokens":true}""" + limitTokenCountTokenFilter( + "testy" + ).consumeAllTokens(true).json.string shouldBe """{"type":"limit","consume_all_tokens":true}""" } } } diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/PatternTokenizerTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/PatternTokenizerTest.scala index 8118172130..b335d2bd7e 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/PatternTokenizerTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/PatternTokenizerTest.scala @@ -8,7 +8,9 @@ class PatternTokenizerTest extends AnyWordSpec with TokenizerApi with Matchers { "PatternTokenizer builder" should { "set flags" in { - patternTokenizer("testy").flags("abc").json.string shouldBe """{"type":"pattern","flags":"abc","pattern":"\\W+"}""" + patternTokenizer( + "testy" + ).flags("abc").json.string shouldBe """{"type":"pattern","flags":"abc","pattern":"\\W+"}""" } "not set flags if not specified" in { patternTokenizer("testy").json.string shouldBe """{"type":"pattern","pattern":"\\W+"}""" diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/ShingleTokenFilterTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/ShingleTokenFilterTest.scala index ee32394623..8ac57b2e2a 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/ShingleTokenFilterTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/ShingleTokenFilterTest.scala @@ -17,13 +17,19 @@ class ShingleTokenFilterTest extends AnyWordSpec with TokenFilterApi with Matche shingleTokenFilter("testy").minShingleSize(11).json.string shouldBe """{"type":"shingle","min_shingle_size":11}""" } "set output unigrams" in { - shingleTokenFilter("testy").outputUnigrams(false).json.string shouldBe """{"type":"shingle","output_unigrams":false}""" + shingleTokenFilter( + "testy" + ).outputUnigrams(false).json.string shouldBe """{"type":"shingle","output_unigrams":false}""" } "set output unigrams if no shingles" in { - shingleTokenFilter("testy").outputUnigramsIfNoShingles(true).json.string shouldBe """{"type":"shingle","output_unigrams_if_no_shingles":true}""" + shingleTokenFilter("testy").outputUnigramsIfNoShingles( + true + ).json.string shouldBe """{"type":"shingle","output_unigrams_if_no_shingles":true}""" } "set token separator" in { - shingleTokenFilter("testy").tokenSeparator("/").json.string shouldBe """{"type":"shingle","token_separator":"/"}""" + shingleTokenFilter( + "testy" + ).tokenSeparator("/").json.string shouldBe """{"type":"shingle","token_separator":"/"}""" } "set filler token" in { shingleTokenFilter("testy").fillerToken("-").json.string shouldBe """{"type":"shingle","filler_token":"-"}""" diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/StopTokenFilterTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/StopTokenFilterTest.scala index f7a01af2e3..86e1f0776b 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/StopTokenFilterTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/StopTokenFilterTest.scala @@ -8,7 +8,10 @@ class StopTokenFilterTest extends AnyWordSpec with TokenFilterApi with Matchers "StopTokenFilter builder" should { "set stop words" in { - stopTokenFilter("testy").stopwords("boo", "foo").json.string shouldBe """{"type":"stop","stopwords":["boo","foo"]}""" + stopTokenFilter("testy").stopwords( + "boo", + "foo" + ).json.string shouldBe """{"type":"stop","stopwords":["boo","foo"]}""" } "set ignore case" in { stopTokenFilter("testy").ignoreCase(true).json.string shouldBe """{"type":"stop","ignore_case":true}""" diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/UniqueTokenFilterTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/UniqueTokenFilterTest.scala index a9326a1839..deefaa9716 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/UniqueTokenFilterTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/analyzers/UniqueTokenFilterTest.scala @@ -11,7 +11,9 @@ class UniqueTokenFilterTest extends AnyWordSpec with AnalyzerApi with Matchers w uniqueTokenFilter("testy").json.string shouldBe """{"type":"unique"}""" } "set only same position" in { - uniqueTokenFilter("testy").onlyOnSamePosition(true).json.string shouldBe """{"type":"unique","only_on_same_position":true}""" + uniqueTokenFilter( + "testy" + ).onlyOnSamePosition(true).json.string shouldBe """{"type":"unique","only_on_same_position":true}""" } } } diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/indexes/IndexTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/indexes/IndexTest.scala index ec2916f3de..259c4db835 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/indexes/IndexTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/indexes/IndexTest.scala @@ -31,7 +31,10 @@ class IndexTest extends AnyWordSpec with Matchers with DockerTests { client.execute { bulk( - indexInto("electronics").fields(Map("name" -> "galaxy", "screensize" -> 5)).withId("55A").version(42L).versionType( + indexInto("electronics").fields(Map( + "name" -> "galaxy", + "screensize" -> 5 + )).withId("55A").version(42L).versionType( VersionType.External ), indexInto("electronics").fields(Map("name" -> "razor", "colours" -> Array("white", "blue"))), diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/update/UpdateByQueryTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/update/UpdateByQueryTest.scala index dd0a25a661..9a81f7581e 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/update/UpdateByQueryTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/update/UpdateByQueryTest.scala @@ -95,7 +95,10 @@ class UpdateByQueryTest }.await val task = client.execute { - updateByQueryAsync("pop", termsQuery("name", "coca")).script(script("ctx._source.foo = 'h'").lang("painless")).refreshImmediately + updateByQueryAsync( + "pop", + termsQuery("name", "coca") + ).script(script("ctx._source.foo = 'h'").lang("painless")).refreshImmediately }.await.result.task // A bit ugly way to poll the task until it's complete diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/InnerHitTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/InnerHitTest.scala index 7594d9e27a..3525075ce2 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/InnerHitTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/InnerHitTest.scala @@ -23,7 +23,10 @@ class InnerHitTest extends AnyWordSpec with Matchers with DockerTests { client.execute { bulk( indexInto(indexName).fields(Map("name" -> "boro", "affiliation" -> "club")).id("1").routing("1"), - indexInto(indexName).fields(Map("name" -> "traore", "affiliation" -> Map("name" -> "player", "parent" -> "1"))).id( + indexInto(indexName).fields(Map( + "name" -> "traore", + "affiliation" -> Map("name" -> "player", "parent" -> "1") + )).id( "2" ).routing("1") ).refreshImmediately diff --git a/project/Dependencies.scala b/project/Dependencies.scala index c7933e9247..a57b152a3e 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -8,29 +8,29 @@ object Dependencies { val CatsEffectVersion = "3.5.7" val CirceVersion = "0.14.10" val CommonsIoVersion = "2.18.0" - val ElasticsearchVersion = "8.16.1" + val ElasticsearchVersion = "8.17.3" val ExtsVersion = "1.61.1" - val Http4sVersion = "0.23.29" - val JacksonVersion = "2.18.2" + val Http4sVersion = "0.23.30" + val JacksonVersion = "2.18.3" val Json4sVersion = "4.0.7" - val Log4jVersion = "2.24.2" - val MockitoVersion = "5.14.2" + val Log4jVersion = "2.24.3" + val MockitoVersion = "5.16.0" val MonixVersion = "3.4.1" val PekkoHttpVersion = "1.1.0" - val PekkoVersion = "1.1.2" + val PekkoVersion = "1.1.3" val PlayJsonVersion = "3.0.4" val ReactiveStreamsVersion = "1.0.4" val ScalatestPlusMockitoArtifactId = "mockito-5-12" val ScalatestPlusVersion = "3.2.19.0" val ScalazVersion = "7.2.36" val ScalatestVersion = "3.2.19" - val Slf4jVersion = "2.0.16" + val Slf4jVersion = "2.0.17" val SprayJsonVersion = "1.3.6" - val SttpVersion = "3.10.1" + val SttpVersion = "3.10.3" val ZIOJson1Version = "0.1.5" val ZIO1Version = "1.0.18" - val ZIOVersion = "2.1.13" - val ZIOJsonVersion = "0.7.3" + val ZIOVersion = "2.1.16" + val ZIOJsonVersion = "0.7.39" lazy val commonDeps = Seq( libraryDependencies ++= Seq( diff --git a/project/build.properties b/project/build.properties index db1723b086..e97b27220f 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.5 +sbt.version=1.10.10 diff --git a/project/metals.sbt b/project/metals.sbt index 43bc609000..3edbb828fb 100644 --- a/project/metals.sbt +++ b/project/metals.sbt @@ -1,4 +1,4 @@ // DO NOT EDIT! This file is auto-generated. // This file enables sbt-bloop to create bloop config files. -addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "2.0.5") +addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "2.0.8") diff --git a/project/plugins.sbt b/project/plugins.sbt index b176f772a9..a72abe6295 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,9 +1,3 @@ -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.3") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") - -addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.3") - -addSbtPlugin("nl.gn0s1s" % "sbt-jackson-version-check" % "0.0.2") - -addSbtPlugin("nl.gn0s1s" % "sbt-pekko-version-check" % "0.0.7") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4") diff --git a/samples/elastic4s-http-client-gradle/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala b/samples/elastic4s-http-client-gradle/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala index 42ecbf4f6c..58c936cff4 100644 --- a/samples/elastic4s-http-client-gradle/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala +++ b/samples/elastic4s-http-client-gradle/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala @@ -15,7 +15,7 @@ object HttpClientExampleApp extends App { client.execute { bulk( indexInto("myindex" / "mytype").fields("country" -> "Mongolia", "capital" -> "Ulaanbaatar"), - indexInto("myindex" / "mytype").fields("country" -> "Namibia", "capital" -> "Windhoek") + indexInto("myindex" / "mytype").fields("country" -> "Namibia", "capital" -> "Windhoek") ).refresh(RefreshPolicy.WaitFor) }.await diff --git a/samples/elastic4s-http-client-maven/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala b/samples/elastic4s-http-client-maven/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala index 42ecbf4f6c..58c936cff4 100644 --- a/samples/elastic4s-http-client-maven/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala +++ b/samples/elastic4s-http-client-maven/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala @@ -15,7 +15,7 @@ object HttpClientExampleApp extends App { client.execute { bulk( indexInto("myindex" / "mytype").fields("country" -> "Mongolia", "capital" -> "Ulaanbaatar"), - indexInto("myindex" / "mytype").fields("country" -> "Namibia", "capital" -> "Windhoek") + indexInto("myindex" / "mytype").fields("country" -> "Namibia", "capital" -> "Windhoek") ).refresh(RefreshPolicy.WaitFor) }.await diff --git a/samples/elastic4s-http-client-sbt/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala b/samples/elastic4s-http-client-sbt/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala index 42ecbf4f6c..58c936cff4 100644 --- a/samples/elastic4s-http-client-sbt/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala +++ b/samples/elastic4s-http-client-sbt/src/main/scala/com/sksamuel/elastic4s/samples/HttpClientExampleApp.scala @@ -15,7 +15,7 @@ object HttpClientExampleApp extends App { client.execute { bulk( indexInto("myindex" / "mytype").fields("country" -> "Mongolia", "capital" -> "Ulaanbaatar"), - indexInto("myindex" / "mytype").fields("country" -> "Namibia", "capital" -> "Windhoek") + indexInto("myindex" / "mytype").fields("country" -> "Namibia", "capital" -> "Windhoek") ).refresh(RefreshPolicy.WaitFor) }.await diff --git a/version.sbt b/version.sbt index 93b1fd68a1..f940ff2aff 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -ThisBuild / version := "8.16.0" +ThisBuild / version := "8.17.0"