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
13
votes
2 answers

how to get started with Elastic Search using scala client

Hi i am new in Elastic Search and i want to use it with scala so i found some codes examples on github, but there was very complex examples were given as for a beginner I spend my whole day in trying to understand this tutorial but at the end i am…
swaheed
  • 3,671
  • 10
  • 42
  • 103
5
votes
1 answer

IOException[Current token (START_OBJECT) not numeric, can not use numeric value accessors

In Elasticsearch getting the following error. RemoteTransportException[[CN8keD-][127.0.0.1:9300][indices:data/write/update]]; nested: RemoteTransportException[[CN8keD-][127.0.0.1:9300] indices:data/write/update[s]]]; nested:…
vikas
  • 61
  • 1
  • 4
5
votes
1 answer

elastic4s: score stays at 1 with rawQuery

We're using elastic4s for ElasticSearch 2.2.0. A number of queries is stored as JSON on disk and used as rawQuery via the elastic4s driver. The score in the result differs between the query being submitted via command line or the elastic4s driver.…
TeTeT
  • 2,044
  • 20
  • 30
5
votes
2 answers

Dynamic ElasticSearch mapping using Elastic4s

I have a document that I want to index on elasticSearch, this document contains some dynamic keys that I can not know in advance, like "spanish" or "french" in the following example "contents": { "title": { "spanish": "Hola amigos", …
ylos
  • 522
  • 1
  • 6
  • 16
4
votes
3 answers

Elastic4s: How do I get all index names from ElasticSearch?

I am using Elastic4s. I need to find all index names from an instance of ElasticSearch. What API shall I use?
Ningjun
  • 41
  • 1
4
votes
2 answers

How track json request sent to Elasticsearch via elastic4s client?

Say that I use such code: ElasticClient client = ... client.execute{search in "places"->"cities" query "paris" start 5 limit 10} How to see what json request was been sent to Elasticsearch?
Cherry
  • 31,309
  • 66
  • 224
  • 364
4
votes
2 answers

Query on a nested field using elastic4s on ElasticSearch

I want to query a nested document that is indexed in ES. For example, the nested field is user which contains two fields id and name. I want to query all documents where the name exactly matches the field user.name. Cannot figure out how to use the…
Soumya Simanta
  • 11,523
  • 24
  • 106
  • 161
3
votes
1 answer

elastic4s NoNodeAvailableException when connecting through TcpClient.transport

Am trying to get my hands on elastic4s by one of the samples as given here But I keep getting the below exception when am trying to connect through TcpClient.transport : Exception in thread "main" NoNodeAvailableException[None of the configured…
AdityaHandadi
  • 149
  • 1
  • 2
  • 13
3
votes
1 answer

elastic4s search for id

two questions regarding searching _id field: I want to find if specific id exists using elastic4s dsl. the aquivilent to this query elasticsearch API: curl -XGET 'http://localhost:9200/indexName/indexType/_search/exists?q=_id:foo' I tried to do…
igx
  • 4,101
  • 11
  • 43
  • 88
3
votes
1 answer

Create index from raw JSON using elastic4s

I need to create an index that has some context completion suggester mappings as in (https://www.elastic.co/guide/en/elasticsearch/reference/current/suggester-context.html). As I see in https://github.com/sksamuel/elastic4s/issues/452 this doesn't…
Iulian
  • 1,496
  • 2
  • 15
  • 35
3
votes
1 answer

elastic4s build query from JSON source

Is there a way to build a query in elastic4s from a JSON string? For example, something like: client.execute { "{ \"query\": ..., \"aggs\": ..., ... }" }
Johan Hirsch
  • 557
  • 4
  • 21
3
votes
3 answers

org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []

I am running ElasticSearch on Docker which is available locally as $ curl http://192.168.99.100:9200/?pretty { "status" : 200, "name" : "Collector", "cluster_name" : "elasticsearch", "version" : { "number" : "1.4.4", "build_hash" :…
daydreamer
  • 87,243
  • 191
  • 450
  • 722
3
votes
1 answer

Is `scan` parameter enabled during scroll in elastic4s?

Here (at the end of table) example about using scrolls in elastic4s but I can not see any API to set scan parameter. Is it enabled by default or should be used with some hooks? By the way Or scan parameter is enabled by default during scrolling in…
Cherry
  • 31,309
  • 66
  • 224
  • 364
3
votes
1 answer

Real difference between curly braces and parenthesis in scala

After using Scala for a while and reading about all over the place and especially here I was sure I know when to use curlies. as a rule of thumb if I want to pass a block of code to be executed i will use curly braces. how ever this nasty bug…
raam86
  • 6,785
  • 2
  • 31
  • 46
3
votes
1 answer

elastic4s does not exit

I tried to run an example code of elastic4s, as follows, import com.sksamuel.elastic4s.ElasticClient import com.sksamuel.elastic4s.ElasticDsl._ object hw extends App { val client = ElasticClient.local client.execute(create index "bands") …
Fei Jiang
  • 330
  • 1
  • 6
1
2 3
10 11