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
0
votes
1 answer

How to add a mapping to an already existing Index with elastic4s?

I would like to know if it's possible to add a mapping for a given type to an already existing index with the elastic4s API? I've looked around and all the examples seem to create the mapping at index creation time, but that's not really what I'm…
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
0
votes
1 answer

elastic4s: deserializing search results

I'm using elastic4s library to query elasticsearch (ES). Version of elastic4s and ES itself 2.4.0. Suppose I have a compound object that I put to ES like case class MyObject(id: Long, vall: KeyVal, vals: Seq[KeyVal]) where KeyVal is case…
Alex
  • 62
  • 8
0
votes
1 answer

elastic4s in Spark Application

I have been trying to use the elastic4s in my spark application but every time it tries to send data to my elasticsearch node I keep getting: java.lang.NoSuchMethodError:…
theMadKing
  • 2,064
  • 7
  • 32
  • 59
0
votes
1 answer

Building dynamic aggregation queries for elasticsearch using elastic4s client

Is it possible to do multi level aggregation queries dynamically using elastic4s DSL. Using http client its straightforward multiLevelAggregation Input: Fields[0..N] Output: Data grouped by field tuple Steps: 1. Build multilevel…
0
votes
1 answer

Emitting the response from the elastic4s subscriber back to the akka-stream

I am currently building a solution to stream data from mongoDb to elasticsearch. My goal is to keep track of all successful transmitted items to elasticsearch. I am using akka-streams and elastic4s. Currently the streaming into es looks like this …
rincewind
  • 623
  • 6
  • 13
0
votes
1 answer

How to define type of objects that all extend a common trait with a recursive type signature

I wrote a method that returns objects that all extend a common trait. I want to specify the return type to be objects with that trait. The complication is that the trait has a recursive type signature. In particular, I am using elastic4s and…
canzar
  • 340
  • 4
  • 17
0
votes
3 answers

elastic4s org.elasticsearch.client.transport.NoNodeAvailableException:

I'm having issues connecting to a local version of elasticsearch. I'm doing the following val uri = ElasticsearchClientUri("elasticsearch://127.0.0.1:9300") val client = ElasticClient.remote(uri) lient execute { search in "_all" query "test" } But…
Steve
  • 21,163
  • 21
  • 69
  • 92
0
votes
1 answer

elastic4s - create template with a given content

I want to use the elastic4s api to delete and create templates. I couldn't find an api to create a template with a given content, only create by providing a name. Not sure how to use the IndexTemplateDsl. Is this the right direction?
Tomer
  • 2,398
  • 1
  • 23
  • 31
0
votes
1 answer

elastic4s - control the analyzer to use in term query

I want to control the analyzer in my search query. At the moment my code looks like this: client.execute(search in indexName / documentType query { bool { must( termQuery("email", email), termQuery("name", name) ) } } How…
Tomer
  • 2,398
  • 1
  • 23
  • 31
0
votes
1 answer

Slick Reactive Streams with multiple joins

I have a very large relational database dataset which I would like to index in elastic search. The query which retrieves the data consists of multiple joins and all other SQL goodies. The data is grouped/processed (in-memory) in order to create…
Mon Calamari
  • 4,403
  • 3
  • 26
  • 44
0
votes
2 answers

how to upsert with parent id in elastic4s

I'm using elastic4s to make index in ElasticSearch. My code as following: var seqBulkDef = SeqBulkCompatibleDefinition seqBulkDef=seqBulkDef:+request(sha256, parentId, indexMap, ES_INDEX, ES_INDEX_TYPE) val resp = client.execute (bulk…
Jack
  • 5,540
  • 13
  • 65
  • 113
0
votes
0 answers

Elastic4s Scripts, Partial Update

I'm trying to update a document by adding/updating an array of objects, using client.execute { update ... }, but I'm having issues trying to pass in key value pairs in Elastic4s. I can't find any documentation on ctx._source, except for this which…
krzasteka
  • 427
  • 1
  • 4
  • 14
0
votes
0 answers

Aggs in Elastic4s

a newbie here! I was trying to use elastic4s to connect elasticsearch with scala. However, I do not find anything to calculate aggregations. Is it not yet supported? What other option do I have?
208rishabh
  • 96
  • 11
0
votes
1 answer

return nested fields using elastic4s

I have data stored with a nested location object and can't figure out how to get elastic4s to return the location as part of the result of a search. I have data that when queried (from the REST endpoint) looks like this: { "_index":…
0
votes
1 answer

How return document from elasticsearch after update?

I am trying to update several document fields and return full document after update. I use elastic4s 1.3.4, elasticsearch 1.4.3 (as server). Here is a code: import scala.concurrent.ExecutionContext.Implicits.global object ElasticsearchTester extends…
Cherry
  • 31,309
  • 66
  • 224
  • 364
1 2 3
10
11