Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 08:19
    solicode commented #1793
  • 02:16
    sksamuel commented #1865
  • 02:16
    sksamuel closed #1865
  • 02:04
    sksamuel commented #1867
  • 02:04
    sksamuel closed #1867
  • 02:03
    sksamuel closed #1866
  • 02:03
    sksamuel closed #1864
  • Sep 18 19:37
    sksamuel closed #1869
  • Sep 18 19:24
    borsik opened #1869
  • Sep 18 14:36
    jdcohen220 opened #1868
  • Sep 18 14:21
    jdcohen220 opened #1867
  • Sep 18 00:01
    scala-steward opened #1866
  • Sep 17 15:54
    eric-taix-teads commented #1865
  • Sep 17 15:38
    eric-taix-teads opened #1865
  • Sep 17 07:37
    radufiser commented #1841
  • Sep 16 16:16
    sksamuel commented #1863
  • Sep 16 13:50
    alexklibisz commented #1863
  • Sep 16 07:06
    scala-steward opened #1864
  • Sep 15 17:26
    sksamuel commented #1854
  • Sep 15 17:25
    sksamuel closed #1854
please @ me if anyone can help.
Quynh Anh "Emma" Nguyen
@yohannesm your import is import com.sksamuel.elastic4s.http.ElasticDsl., maybe it should be import com.sksamuel.elastic4s.http.ElasticDsl._?
Hey. Could you update the readMe for the new changes like ElasticClient,?
Abdhesh Kumar
Is there a way to mock elasticsearch response. LikeSearchResponse?
Dmitrii Naumenko
@yohannesm Is your issue still actual?
Rafael Grillo
@sksamuel do you have a planned date for next release?
Derya Aydede
how do you guys typically handle the ES json response? i've just been parsing it as json, but is there any better way? if I do an aggregation for example, and maybe it's nested or whatever right, so with the path to the buckets I want I have to build the ES query based on that obviously and then again walk the JSON tree based on that path as well
also, great library! this thing has been a life saver for me
Alice Fuzier Cayla
Hi, I've just commented on a very old and closed issue: sksamuel/elastic4s#1093. Basically, we need to pass search_type parameter to a 5.6.x cluster but the 5.6.x release of elastic4s has a bug where it sends the search_type in all capitals when it should be lowercase. According to the issue the bug was fixed in 6.x versions of the library but not 5.6.x. Any reason for that? Any objections to me raising a PR to backport this fix to 5.6.x?
Inigo Mediavilla
Hi, is it possible to do this kind of authentication with elastic4s https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html ?
I mean, do I need to create a custom client or it is already included in the library ?
Saurabh Rawat
hi, I am getting could not find implicit value for parameter handler: com.sksamuel.elastic4s.http.Handler[com.sksamuel.elastic4s.mappings.MappingDefinition, _]
I imported everything under the sun
import com.sksamuel.elastic4s.ElasticImplicits._
import com.sksamuel.elastic4s.indexes._
import com.sksamuel.elastic4s.http.ElasticDsl._
import com.sksamuel.elastic4s._
import com.sksamuel.elastic4s.mappings._
import com.sksamuel.elastic4s.mappings.MappingDefinition._
import com.sksamuel.elastic4s.mappings.dynamictemplate._
import com.sksamuel.elastic4s.analyzers._
import com.sksamuel.elastic4s.mappings.dynamictemplate.DynamicMapping
import com.sksamuel.elastic4s.circe._
where is it?
Saurabh Rawat
it's supposed to be getMapping instead of mapping as shown in the issue, added a comment
Abdullah Velioğlu

Hi everybody,

I have a question.

This is my elastic4s query
.query( functionScoreQuery( boolQuery() .must( matchQuery("username", searchText), existsQuery("photoUrl")) .not( termQuery("photoUrl", pudraConfig.defaultUserPhotoUrl), termsQuery("id", blockedUserIds ::: List(0))) ).functions( fieldFactorScore("popularity") modifier SQRT factor 1 missing 1 ))

This is my elasticsearch api query

{ "query": { "function_score": { "query": { "match": { "username": "exampleusername" } }, "field_value_factor": { "field": "popularity", "factor": 1, "modifier": "sqrt", "missing": 1 } } } }

2 request looks like some but response not equal. This problem is modifier field. If I don't send modifier tag from elasticsearch api; it will response is same.

What am I wrong?

Sebastian Bruckner

Good morning together!

Is it possible to activate the Host Sniffer (https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/sniffer.html) with the Elastic4s HTTP Client?

Nepomuk Seiler
@Sebruck I guess opening a pull request is the best action here :kissing_heart: . Hope you are doing fine :heart:
I try to do an upsert but i'm confused with the documentation
i don't know how to pass the id field to the request
any suggestion ?
in `val resp = client.execute { update(5).in("scifi/startrek").doc( "name" -> "spock", "race" -> "vulcan" ) }, how do we specify the field that stands for the id ?
Iliescu Cristian-Teodor

Hi. I try do update a field from a document that is an object , i've tried like this
doc ("query" -> obj,
doc ("query" -> obj.asJson,
doc ("query" -> obj.asJson.noSpaces and I receive

BulkError(mapper_parsing_exception,object mapping for [result] tried to parse field [result] as object, but found a concrete value.

Any suggestion?

Daulet Kabdiyev

Hi all,
I have the following problem: during the request to Elasticsearch, service raises the following exception:

com.sksamuel.elastic4s.http.JavaClientExceptionWrapper: java.io.IOException: Connection reset by peer
    at com.sksamuel.elastic4s.http.ElasticsearchJavaRestClient$$anon$1.onFailure(ElasticsearchJavaRestClient.scala:53)
    at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:629)
    at org.elasticsearch.client.RestClient$1.retryIfPossible(RestClient.java:419)
    at org.elasticsearch.client.RestClient$1.failed(RestClient.java:398)

I couldn't find solution after googling. Elasticsearch server version is 6.5.3, while elastic4s version used by service is 6.2.10. I was wondering if the problem can be related to library version and if I should upgrade it to 6.5.1?


did someone use copy_to with elastic4s? I have a query where i need the ability to use cross field query, but using cross_fields query type is not allowed with fuzziness...

my query currently looks like:

  val query = should(
        .field("formalName", 4)

and it workds great, I just want to add the ability to search by vatId and formal name together...

Nir Ohayon
i need this too...:/
Santiago Suárez P.
Hi everybody.
I have an index in ES that contains, among other fields, a long field and a text field that has an Id
I need to group by the id field, sort by the long field and get the whole source. Been reading a while and trying some stuff but I'm not sure how to do it. I know I need an aggregation, but how can I tell ES to return just one source per group?
Santiago Suárez P.
Hello, I've been trying to use the composite aggregation but it is not referenced in AggregationApi. Any reasons for this?
Hi all
I have a question what is the best way to use geodistance query
I have a quick question on the SearchIterator. The example you must specify a keepAlive value for ES scrolling. I noticed when implementing this myself you also must specify an implicit val Duration. What is the purpose of this versus the keepAlive?
I have a few questions about getting request and response results but I’m not sure if anybody is here.
Gabriele Favaretto
Hi, how can I get a client like this with version 7
      new RequestConfigCallback {
        override def customizeRequestConfig(requestConfigBuilder: Builder): Builder = {
      new HttpClientConfigCallback {
        override def customizeHttpClient(httpClientBuilder: HttpAsyncClientBuilder): HttpAsyncClientBuilder = {
Gabriele Favaretto
with Akka Http client
Gabriele Favaretto
nobody can help me with the Akka client??
Yianni G
Is the latest HTTP client compatable w/ V7?
Hello i am getting elastic search following error while creating a document java.lang.IllegalArgumentException: mapper [variables.actions.variables.value] of different type, current_type [date], merged_type [keyword]
my Request json is
"ProcessName":"HSE Observation",
"ProcessInstanceName":"HSE Observation",
"AppName":"HSE Observation",
"ProcessStartDate":"06-May-2019 11:49:04",
"StartUserName":"Mohammed Ibrahim",
"taskDescription":"test 6519 518",
"moduleName":"HSE Observation",
"reviewedby":"Yunus Khan",
"company_LABEL":"Barik Group",
"greetingTask":"Hello World!",
"observedby":"Mohammed Ibrahim",
"immediateactionstaken":"test 6519 518",
"locationName":"Barik IT Solutions",
"observationrating_LABEL":"1 = has minimal impact (accepted)",
"greeting2ProcLocal":"Hello World Local!",
"describelocation":"test 6519 518",
"reviewerscomment":"test 6519 523",
"greeting2Proc":"Hello World!",
"observationrating":"1 = has minimal impact (accepted)",
"value":"test 6519 522",
"value":"test 6519 521",
"value":"Yunus Khan",
and my template is

"template": "bpmanalyticseventlog",
"settings": {
"index": {
"analysis": {
"analyzer": {
"standard": {
"filter": [
"type": "standard",
"tokenizer": "keyword"
"mappings": {
"bpmanalyticsevent": {
"dynamic": "true",
"dynamic_templates": [
"string_fields": {
"mapping": {
"omit_norms": true,
"type": "keyword"
"match_mapping_type": "string",
"match": "
"variable_mappings": {
"path_match": "variables.",
"mapping": {
"type": "{dynamic_type}"
"tasks_mappings": {
"path_match": "tasks.
"mapping": {
"type": "{dynamic_type}"
"startprocess_variable_mappings": {
"path_match": "processStartVariables.",
"mapping": {
"type": "{dynamic_type}"
"custom_processmappings": {
"path_match": "processSpecificCustomMap.
"mapping": {
"type": "{dynamic_type}"
"task_complete_variable_mappings": {
"path_match": "taskCompleteVariables.*",
"mapping": {
"type": "{dynamic_type}"
"properties": {
"ProcessStartDate": {
"format": "dd-MMM-yyyy HH:mm:ss",
"type": "date"
"TaskDueDate": {
"format": "dd-MMM-yyyy HH:mm:ss",
"type": "date"
"TaskStartDate": {
"format": "dd-MMM-yyyy HH:mm:ss",
"type": "date"
"ProcessEndDate": {
"format": "dd-MMM-yyyy HH:mm:ss",
"type": "date"
"TaskEndDate": {
"format": "dd-MMM-yyyy HH:mm:ss",
"type": "date"
"TaskClaimDate": {
"format": "dd-MMM-yyyy HH:mm:ss",
"type": "date"
"aliases": {}


can any one please suggest whats wrong with my _template for the above document
@sksamuel Hi ! How is it going with release for Scala 2.13?
James Gorrie
Hi all - having an easy time migrating from 6 => 7, with one exception, not understanding how to implement language analysers with the new analysis package, any pointers?
Hi I've got a quetion is possible use The hitReader typeclass with circe
Declan Neilson
hi all, wondering if anyone can help me with my issue, i'm running a trivial query that i can't share but it's just a search, query, size, aggs however every time i run it i'm getting a [error] Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.sksamuel.elastic4s.requests.searches.Total (although at least one Creator exists): no int/Int-argument constructor/factory method to deserialize from Number value (92543)` and i can't seem to figure out why, would appreciate any advice
Dragutin Marjanović

Hey, do you know how I can handle error in stream?

I'm using elastic4s streams. When Elasticsearch responds with "error" (e.g. Connection Refused), it kills stream. I found

// if an error we will cancel the subscription as we cannot for sure handle further elements
    // and the error may be from outside the subscriber

part of code which cancel subscription. Can I avoid this? And possible provide retry strategy instead?

Thanks in advance.

Tim Cropper

I'm trying to apply a fieldSort to an innerhit, and the entire fieldSortDefinition is being returned. Please see code below for more info. I'm currently using elastic4s 5.5.6.
inner hit query:


sort field of executed query:

"sort": [

expected sort field:


Thanks, and let me know if I can provide any additional information.