Questions tagged [elastic4s]

Elastic4s is mostly a wrapper around the standard Elasticsearch Java client with the intention of creating a concise, idiomatic, reactive, type safe DSL for applications in Scala that use Elasticsearch.

Elastic4s is mostly a wrapper around the standard Elasticsearch Java client with the intention of creating a concise, idiomatic, reactive, type safe DSL for applications in Scala that use Elasticsearch. The Java client, which can of course be used directly in Scala, is more verbose due to Java's nature. Scala lets us do better.

Elastic4s's DSL allows you to to construct your requests programmatically, with syntactic and semantic errors manifested at compile time, and uses standard Scala futures to enable you to easily integrate into your existing asynchronous workflow. The aim of the DSL is that requests are written in an SQL-like way, while staying true to the Java API or Rest API.

Elastic4s supports Scala collections so you don't have to do tedious conversions from your Scala domain classes into Java collections. It also allows you to index documents directly without having to extract and set fields manually - eg from a case class, a JSON document, or a Map (or a custom source). Due to its typesafe nature, it is easy to see what operations are available for any request type, because your IDE can use type information to show what methods are available.

161 questions
1
vote
1 answer

Implementing Junit @BeforeAll like behaviour in scalatest

I am using scalatest to write unit tests in my application.I want to start embedded elastic server before starting my test suites and tear it down once all the test suite complete. Scalatest provides BeforeAndAfterAll and BeforeAndAfter traits but…
1
vote
0 answers

Caused by: java.net.UnknownHostException: username:password@192.192.xx.xxx: invalid IPv6 address

I have elastic cluster with secure connection of search guard. I am trying to connect elastic search with elastic4s using scala language. import com.sksamuel.elastic4s.ElasticsearchClientUri import com.sksamuel.elastic4s.http.{ElasticClient, …
1
vote
1 answer

elastic4s with ssl configured elastic Search not working

Below is the script that I am using to access index data from elasticsearch in spark scala code. It is working perfectly. import com.sksamuel.elastic4s.http.{ElasticClient, ElasticProperties} import com.sksamuel.elastic4s.http.ElasticDsl._ val…
Nikhil Suthar
  • 2,289
  • 1
  • 6
  • 24
1
vote
1 answer

Scala: To fetch more than 10000 documents/messages from Elasticsearch

I am using Scala 2.12 and we have Elasticsearch 5.2.2. My requirement is for only fetch/search based on the criteria. The search will return more than 10,000 documents or messages at one go. So I cannot use the regular search. The data (each…
Mihir
  • 531
  • 2
  • 10
  • 35
1
vote
2 answers

Is it possible to avoid .await with Elastic4s

I'm using Elastic4s (Scala Client for ElasticSearch). I can retrieve multiGet results with await : val client = HttpClient(ElasticsearchClientUri(esHosts, esPort)) val resp = client.execute { multiget( get(C1) from "mlphi_crm_0/profiles"…
1
vote
0 answers

None of the configured nodes are available: [{#transport#-1}{ }{IPAddress}{IPADDRESS:9300}]

While establishing the connection with elassandra cluster through elastic4s getting the follow error. NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{…}{IPAddress{IPAddress:9300}]] val settings =…
vikas
  • 61
  • 1
  • 4
1
vote
1 answer

elastic4s 6.2.2 HttpClient issues

Recently I found out that elastic4s TcpClient is deprecated and going to be removed in 7.x versions. I tried to migrate to HttpClient and faced the following issue; suppose we have a following insert operation: val client =…
Alex
  • 62
  • 8
1
vote
0 answers

How to Compress bulk insert with elastic4s and HttpClient

I try to compress the bulk insert into ElasticSearch but I have some trouble. I have no idea how to do it. There is the code : val client = HttpClient(ElasticsearchClientUri("localhost", 9200)) client.execute { bulk( indexInto("myindex"…
Lip
  • 91
  • 1
  • 9
1
vote
1 answer

ElasticSearch test http client

My application should start an es server, I mean a local node, in the tests. The client should be a HttpClient. val clusterName: String = "getting-started-with-elastic4s" val homePath: Path = Files.createTempDirectory(clusterName) val localNode =…
gg gg
  • 129
  • 7
1
vote
1 answer

Elastic search functionScore vs sort by script

I want to change the score of the results from query. I can change the result by boosting and filtering. However, I can do this both function score and script query. What is the difference between them? For example:…
gg gg
  • 129
  • 7
1
vote
1 answer

Elastic4s - HTTPS connection to Elasticsearch cluster

I'm trying to connect to Elasticsearch using elastic4s-http vis https but can't find a way to use https instead of http. I'm currently using: HttpClient(ElasticsearchClientUri(config.getString("services.elasticsearch.host"),…
adamtrousdale
  • 415
  • 6
  • 18
1
vote
1 answer

RemoteTransportException, Fielddata is disabled on text fields when doing aggregation on text field

I am migrating from 2.x to 5.x I am adding values to the index like this indexInto (indexName / indexType) id someKey source foo however I would also want to fetch all values by field: def getValues(tag: String) ={ client execute…
igx
  • 4,101
  • 11
  • 43
  • 88
1
vote
1 answer

Multifield in Elastic4s 5.x

I'm currently using Elastic4s v5.0, which still has the multifield type used to index a field in more than one way. elasticClient.execute(createIndex("foo") mappings ( mapping("bar").as( multiField("baz").as( textField("baz") analyzer…
cowboybebop
  • 2,225
  • 3
  • 21
  • 31
1
vote
1 answer

Elastic gives inconsistent results under stress

Our ES is fairly slow, we did not optimize it (and the query) yet, but according to this link, request rejection from Elastic is a form of a feedback that asks to slow down and adapt the size of the bulk. We built a form of a back pressure where the…
Mironor
  • 1,157
  • 10
  • 25
1
vote
1 answer

Is there any good example for ElasticSearch 5.1.1 Scala API using sksamuel/elastic4s or anything else?

I am not able to find a good example for ElasticSearch 5.1.1 using Scala in sksamuel/elastic4s. Documentation is not very helpful and none of the site have any good example for it. Even a simple example to create Index, Put data and search will be…
Amar Singh
  • 13
  • 3