Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Sep 27 16:32
    camimora edited #2532
  • Sep 27 05:26
    gertv opened #2533
  • Sep 26 18:39
    stale[bot] labeled #2367
  • Sep 26 18:39
    stale[bot] commented #2367
  • Sep 26 05:28
    camimora edited #2532
  • Sep 26 05:28
    camimora edited #2532
  • Sep 26 05:26
    camimora edited #2532
  • Sep 26 05:26
    camimora edited #2532
  • Sep 26 05:23
    camimora edited #2532
  • Sep 26 04:49
    camimora edited #2532
  • Sep 26 04:47
    camimora opened #2532
  • Sep 24 16:16
    nespera opened #2531
  • Sep 24 15:58
    nespera opened #2530
  • Sep 23 14:09
    eugeneatnezasa commented #2464
  • Sep 23 09:03
    hughsimpson commented #2502
  • Sep 23 09:01
    hughsimpson commented #2502
  • Sep 22 20:04
    scala-steward opened #2529
  • Sep 21 15:47
    sksamuel closed #2528
  • Sep 21 15:38
    scala-steward opened #2528
  • Sep 21 09:19
    jason-yeo-paidy opened #2527
Michał Kłoda
Actually there is no need of second query. I can just create another aggregate in the same query.
Valentine Rozental
Hello all. I run search that returns more than max_result_window is set. Should I use ScrollApi to retrieve all results? Will appreciate a reference to a code sample. Thank you!
Gajendra Naidu Thalapaneni
Do we have support for creating Point in Time(PIT) through elastic4s?
Gajendra Naidu Thalapaneni
Also not finding search capability using pit_id. I guess this is also not supported.
Sam Sam
Bot yet
Gajendra Naidu Thalapaneni
Thanks @sksamuel
Is there a 7.8.x release with seq_no_primary_term?
1 reply
(In the search API)
Thijs Broersen
when will there be a next release? I noticed master got updated with a lot of bumped dependencies 11 days ago ... CI-badge says 'passing'
1 reply
Using Elastic4s 7.12, does anyone know the magic implicit import for this error: No implicit arguments of type: Handler[SearchRequest, U_]? TIA!
1 reply
If it helps, the test is here: https://github.com/objektwerks/elasticsearch/blob/master/src/test/scala/objektwerks/Elastic4sTest.scala
A lot has changed since I last used Elastic4s 3 years ago.:)
I've uncovered a new error: missing BuildableTermsQuery in the classpath I'm unable to locate the magic jar for that dependency.
1 reply
Andrius Bentkus
@objektwerks any progress on that?
@txdv Nope. I just documented the issue in my project, and moved on. Sometimes open source projects just sort of fade into the sunset. :)
4 replies
Alex Priadko
Hi All, do you know how I can write integration tests with Http rest client? the main problem what should I use as ES server.
Sam Sam
Use a docker instance of ES like the elastic4s tests do
Alex Priadko
Thanks, for confirmation. I was thinking about some embedded Elasticsearch, but as I can see it is not an option, only Docker. Thank you.
Domantas Petrauskas
Hey, I think the 7.4.x branch is broken. 7.4.1 release, which has since been removed, seems to have been made from master branch and not 7.4.x branch, which resulted in a lot more changes being brought in - https://github.com/sksamuel/elastic4s/compare/v7.4.0...v7.4.2.
Sergey Ryazanov
I have a problem, with IpField

Hi all, I couldn't see anything in the doco so i thought i would ask here;
I am trying to send a request with basic auth using the akka http client to my ES instance, but the responses are 401 (double checked the username and pass was good) I am invoking like so;


config looks like this;

com.sksamuel.elastic4s.akka {
  queue-size = 1000
  blacklist {
    min-duration = 1m
    max-duration = 30m
  max-retry-timeout = 30s
  username = username
  password = password

And I am getting back a 401 unauthorized. Is there anyway to debug the headers that are being sent from the elastic HTTP client at all?

Can someone point me to a example of how to process a query in which hits returned will come with inner_hits ? I want to know as to How do I read inner_hits from an incoming Hit and use a HitReader Typeclass instance to process it.

Does anyone else have problem upgrade to the latest 7.12.1? Previously with 7.12.0, I don't have any problem fetching the jars. After I bumped the version, now I'm getting the following error:
sbt.librarymanagement.ResolveException: Error downloading com.sksamuel.elastic4s:elastic4s-client-core_2.13:7.12.1

But I don't have this dependency. I checked Maven and Maven doesn't have this jar. It doesn't have any jar with this elastic4s-client-core even for older versions either.

If I clear the cache and switch back to 7.12.0, sbt has no problem downloading 7.12.0 jars.

So something must have changed for 7.12.1. What is this elastic4s-client-core?

Sergey Ryazanov
@voonchav_gitlab I have the same problem
Alex Priadko
Hi all, do you know what a request should I use to get information from Field capabilities API https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html ?
Avdhut Kulkarni

Hi, All any help would be helpfull. {
"suggest": {
"venue-suggest": {
"prefix": "Vinkari",
"completion": {
"field": "suggest",
"size": 10,
"contexts": {
"location": {
"lat": 42.360415,
"lon": -71.059699,
"precision": 1
}. creating this query for context suggester but in the code side .
val location = Map("location"->Seq(CategoryContext(Json.stringify(Json.obj("lat"->lat,"long"-> long,"precision"-> 2)))))
val newGeneratedQuery = complitionSuggestion.contexts(location)
val definition: SearchDefinition = search(indexName) types indexType from start size limit suggestions newGeneratedQuery

@sksamuel not having the context suggester example for the location trace search result. while adding the Json while hitting the URL it will generate query with escape characters.

Nicholas Molenaar
Hey guys, is there a possibility to add a Seq[Qeury] to the search builder?
Nicholas Molenaar
It feels like im searching for a queryBuilder but I cannot seem to find any reference in the docs.
Avshalom Orenstein
Hi guys! Im using multimatch queries and I noticed that when the query is bigger then 1K im getting degradation in performance (each query takes between 10 seconds - 20 seconds). I tried to split them and do smaller queries in parallel and then combine the results but Im still getting the same time... does anyone has a clue how can I do it right and reduce the query/queries latency?
Hello, all! What would be a best practice to query for range on a nested field? Also, I can't see any way to sort asc / desc by using a nested field, as well. Any help will be really appreciated, since I haven't found much into the docs. Thanks!

Can someone point to an example of building: DateRangeAggregation from a list of datemath expressions: Seq("now-1d/d", "now-1w/w", "now-1m/m", "now-6m/m"...) and so on. I want to aggregate documents counts which are modified within 1d, 1 week, 1 month, 6 months and 1 year.

My code to generate Aggregation is like this:

val dateRangesStrings = Seq("now-1d/d", "now-1w/w", "now-1m/m", "now-6m/m"...)
      name = "RecencyFilter",
      field = Some("modifiedAt"),
      unboundedFrom = dateRangesStrings.map(timeString ⇒ (Some(timeString), ElasticDate(str = timeString))).toList

When I run this, I get an error:

Some(ElasticError(parse_exception,operator not supported for date math [-1d/d||],None,None,None,null,None,None,None,List()))

Andrew Valencik
Could someone kick off the GitHub actions / checks on this: sksamuel/elastic4s#2474
@jbenoit2011 did you ever happen to create an http4s client for elastic4s?
Alex Priadko
Could someone help with a deprecated method in XContentBuilder? Methods string and bytes marked as deprecated with the comment "will be replaced with a pluggable system". Does anyone have an example of how to use that "pluggable system"?
Manuel Mejia
Has anyone here ever tried to use two different versions of elastic4s concurrently? Currently in the process of upgrading from 5 to 7, but not a simple upgrade since mapping types and joins changed
We have several large clusters, so we're going to migrate each one at different points, so need to support both.
I'm looking at upgrading from cats-effect 2.x to cats-effect 3.x. We're on the 7.12.3 version of the elastic4s library is there a different artifact I need to pull?

Hi everyone. Noob question here :). I have this DTO Test(a: String, b: Option[Json]). That Json is a circe type. How should I parse the es SearchResponse to my DTO? I'm trying using a custom audit reader like:

implicit object TestHitReader extends HitReader[Test] {
   override def read(hit: Hit):  Try[Test] = {
  val b = source.get("b").map(attr => attr.asJson)
  val a = source.get("a").map(_.toString) // lot of this things as my dto is larger
  Try(Test(b = b))

However, my dto is longer than that and I'm doing a lot of things that, except for the json field, work out of the box
Any suggestion is appreciated.

3 replies
Atibhi Agrawal
Hi all,
Is there any way to create a client without using the JavaClient or using the com.elastic4s.http library.
I tried this but it does not work. It says type mismatch, needed HTTPclient
import com.sksamuel.elastic4s.ElasticDsl._
import com.sksamuel.elastic4s.{ElasticProperties, _}
import com.sksamuel.elastic4s.fields.TextField
import com.sksamuel.elastic4s.requests.common.RefreshPolicy
import com.sksamuel.elastic4s.requests.searches.SearchResponse

 val client = ElasticClient(ElasticProperties(
      s"http://${sys.env.getOrElse("ES_HOST", "")}:${sys.env.getOrElse("ES_PORT", "9200")}"))
2 replies

Hi All,

Is there a way to pass the Elasticsearch libraries XContentBuilder to the elastic4s library index command or is there a way to use the elastic4s XContentBuilder since I'm having issues with just this code

    implicit val xb: XContentBuilder = XContentFactory.jsonBuilder()

which is tossing
com.sksamuel.elastic4s.json.ObjectValue cannot be cast to com.sksamuel.elastic4s.json.ArrayValue

Jason Yeo
Hi everyone! is there a changelog or a migration guide? I'm trying to upgrade from v6.X.X to v7.X.X and I'm running into issues
like what happened to the slashes in indexInto("foo" / "bar")? It's missing now
Kaushal Shah
trying to use TcpClient and HttpClient together for an api app, are there any know issues when using both together?
How do you do mapping for a field representing a Seq of String?
like, in following example we map to a Textfield, 'name'
client.execute {