From e04ce882dc26bd381c46728a6b537427d5548ea7 Mon Sep 17 00:00:00 2001 From: Philippus Baalman Date: Wed, 26 Jun 2024 10:35:30 +0200 Subject: [PATCH] Fix GetSynonymsSetResponse (#3097) --- .../elastic4s/requests/synonyms/GetSynonymsSetResponse.scala | 4 +++- .../sksamuel/elastic4s/requests/synonyms/SynonymsTest.scala | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/synonyms/GetSynonymsSetResponse.scala b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/synonyms/GetSynonymsSetResponse.scala index 67e70802f..14498d8f3 100644 --- a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/synonyms/GetSynonymsSetResponse.scala +++ b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/synonyms/GetSynonymsSetResponse.scala @@ -1,3 +1,5 @@ package com.sksamuel.elastic4s.requests.synonyms -case class GetSynonymsSetResponse(count: Int, synonymsSet: Seq[SynonymRule]) +import com.fasterxml.jackson.annotation.JsonProperty + +case class GetSynonymsSetResponse(count: Int, @JsonProperty("synonyms_set") synonymsSet: Seq[SynonymRule]) diff --git a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/synonyms/SynonymsTest.scala b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/synonyms/SynonymsTest.scala index a80404c56..490b97516 100644 --- a/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/synonyms/SynonymsTest.scala +++ b/elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/synonyms/SynonymsTest.scala @@ -26,8 +26,8 @@ class SynonymsTest extends AnyFlatSpec with Matchers with ElasticDsl with Docker val resp = client.execute { getSynonymsSet("my-synonyms-set") }.await.result - resp.count shouldBe 3 + resp.synonymsSet.map(_.synonyms).toSet shouldBe Set("hello, hi", "bye, goodbye", "test => check") } it should "handle errors" in {