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

Fields are empty when doing GET in elastic4s

I'm trying to implement a service in my play2 app that uses elastic4s to get a document by Id. My document in elasticsearch: curl -XGET 'http://localhost:9200/test/venues/3659653' { "_index": "test", "_type": "venues", "_id":…
jakob
  • 5,979
  • 7
  • 64
  • 103
3
votes
1 answer

not found value index error on elastic4s

im trying to index some data to elastic search by using the elastic4s API but im getting compile error not found: value index this is the code , later on i will map the js object fields to the elastic search fields , but for now i just want to…
MIkCode
  • 2,655
  • 5
  • 28
  • 46
2
votes
1 answer

Elastic4S - Jackson's class ScalaObjectMapper isn't found and throws a NoSuchMethodError

I'm having an issue while using Elastic4S in a Scala project. The following error is thrown : java.lang.NoSuchMethodError: …
Ismail H
  • 4,226
  • 2
  • 38
  • 61
2
votes
2 answers

HttpClient not found in elastic4s?

I am getting below error while using HttpClient. Can you let me know how to use HttpClient exactly. I am new with elastic4s. I want to connect scala with ssl configured elasticsearch. I also want to know how I can pass SSL details with link such as…
user8488183
2
votes
2 answers

Find all distinct values for particular field in index by using Elastic4s client

How can I use elastic4s to get all distinct values for particular field? Example in JSON: GET persons/_search {  "size":"0",  "aggs" : {   "uniq_gender" : {    "terms" : { "field" : "Gender" }    }   } }
smaiakov
  • 470
  • 5
  • 20
2
votes
1 answer

elasticsearch giving more weight to different fields and scenarios

I have this ES query: { "query": { "bool": { "should": [ { "multi_match": { "query": "test", "fields": [ "name^-1.0", "id^-1.0", "address.city^-1.0", …
JohnBigs
  • 2,691
  • 3
  • 31
  • 61
2
votes
1 answer

access array element in elasticsearch using elastic4s

I wanted to delete an element from the Array, as shown below I inserted a testindiex with type test and document with an Array inside, in elasticsearch using elastic4s. I wanted to delete a value ex: tony from members - how can I do this val…
2
votes
0 answers

Elastic search multiple analyzers for one field

I have a field "name" and I want to analyze it with two analyzers: name typed StringType analyzer CustomAnalyzer("partial") analyzer CustomAnalyzer("all") The problem is that in analyzer function it sets the analyzer one value. The result…
gg gg
  • 129
  • 7
2
votes
0 answers

elastic4s akka stream sink with HttpClient

I am trying to stream data from a file to elastic search using akka streams and elastic4s. I have a Movie object than can be inserted into elastic search and am able to index objects of this type using the httpclient: val httpClient =…
Doug Anderson
  • 245
  • 1
  • 2
  • 10
2
votes
1 answer

How to get all fields in elasticsearch

How to get all field names (not values) under _source using elastic4s ? I want a list of all mapped fields . I tried doing something like: search in indexName / indexType sourceInclude "_source" limit q.limit aggregations( …
igx
  • 4,101
  • 11
  • 43
  • 88
2
votes
2 answers

What is `path.home` variable and how do I set it?

I have been using the elastic4s elasticsearch driver. When attempting to create a client: import com.sksamuel.elastic4s._ import org.elasticsearch.common.settings._ val esSettings = //... val client = ElasticClient local esSettings I recieve a…
Rhys Bradbury
  • 1,699
  • 13
  • 24
2
votes
2 answers

Elasticsearch - how to append term?

Is there a way to append term into an array of values? For example if my document looks like this: { "items": ["item1", "item2", "item3"] } I want to append "item4" and "item5" to it. I must do it in 2 queries? one to load the current list of…
Tomer
  • 2,398
  • 1
  • 23
  • 31
2
votes
1 answer

NotXContentException when serializing Scala object to Json and indexing into Elasticsearch

I am attempting to index a relatively complex Scala object in Elasticsearch. Here are my case classes: case class Game(id: Int, gameStates: Seq[GameState], playerActions: Map[String, PlayerAction], gameActions:…
DanHam
  • 340
  • 2
  • 17
2
votes
1 answer

Using Elastic4s to register a query with the percolator

I'm trying to register a percolator query with the elastic4s library. After much research I've found I need to use something like: val myQuery = """ { "query" : { "match" : { "foo" : "bar" } } } """ esClient.execute( register id 12345 into "baz"…
Ryan Wilson
  • 1,743
  • 3
  • 15
  • 26
2
votes
2 answers

Embedded ES instance failing when running unit tests

I currently have the following code. The following is setting up a local elasticsearch instance using the elastic4s library val essettings = Settings .settingsBuilder().put("cluster.name", "elasticsearch") .put("path.home",…
rebnat
  • 121
  • 9
1
2
3
10 11