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

How do I log all queries in embedded ElasticSearch?

I'm trying to debug an ElasticSearch query. I've enabled explain for the problematic query, and that is showing that the query is doing a product of intermediate scores where it should be doing a sum. (I'm creating the query request using…
Robin Green
  • 32,079
  • 16
  • 104
  • 187
1
vote
1 answer

Is elastic4s 2.3.0 supporting Update By Query Api?

I have a question regarding with the Update By Query Api in Elastic Search. I'm using sksamuel.elastic4 2.3.0 library. https://github.com/sksamuel/elastic4s As i know this library supports "update" api but i couldn't find the update by query…
sbb
  • 529
  • 3
  • 25
1
vote
1 answer

Elastic4s search case class example errors when result document is missing a field

I've been working with this example from the Elastic4s manual. It is working fine until it attempts to retrieve a document that does not have a field specified in the case class. In this example from the manual, let's say one result only had name…
Jimmy Hendricks
  • 263
  • 1
  • 3
  • 13
1
vote
1 answer

Elastic4s / PlayFramework - could not find implicit value for parameter executable

I am trying to use ElasticSearch with Play 2.3.7 Scala. I have installed elastic search, added an index, and have it up and running (tested using curl). However, I am struggling to get elastic4s to work inside of a play controller. I have created…
Codemwnci
  • 54,176
  • 10
  • 96
  • 129
1
vote
0 answers

How to write and query data from elasticsearch within several concurrent processes?

I am writing a simple application in Scala that listens to Kafka on different topics and when an event on writing comes I write the data down in ElasticSearch. I'm using elastic4s as a wrapper around ElasticSearch Java API. So listening to different…
D. Joe
  • 33
  • 1
  • 5
1
vote
1 answer

elastic4s: how to add analyzer/filter for german_phonebook to analysis?

How do I add the following german_phonebook analyzer to elastic search using elastic4s? "index": { "analysis": { "analyzer": { "german": { "filter": [ …
TeTeT
  • 2,044
  • 20
  • 30
1
vote
1 answer

What happens during Play! controller instantiation?

I experience strange behavior within controllers in Play framework. I am using elastic4s to connect to an Elasticsearch cluster, and depending precise timing of establishing the connection it either works or it doesn't. My minimal-so-far example…
Wojciech Ptak
  • 683
  • 4
  • 14
1
vote
1 answer

Is it possible/advisable to index a String of JSON data using elastic4s?

I am trying to pass a string of JSON data into an indexing statement like this, where inputDoc is my string of JSON: def Update(client: ElasticClient, idx:String, `type`: String, inputDoc: String): Unit = { val address = idx + "/" + `type` …
DanHam
  • 340
  • 2
  • 17
1
vote
2 answers

Using Elastic4s for Percolator Queries

I'm currently trying to create a percolator query with Elastic4s. I've got about this far but I can't seem to find any examples so I'm not sure how this quite works. So I've got: val percQuery = percolate in esIndex / esType query…
Ryan Wilson
  • 1,743
  • 3
  • 15
  • 26
1
vote
1 answer

Completion search in Embedded ES instance

I am trying to get completion searching working in an embedded instance for unit testing. I am using elastic4s and elasticsearch 2.0.x My working code is as follows: val nIndex = create index "musicbrainz" shards 5 replicas 1 mappings( …
rebnat
  • 121
  • 9
1
vote
1 answer

Using elastic4s local client for testing

I've been using elastic4s for my data retrieval and have begun looking into testing for my current code. I am trying to create a local client that I can then use (and pass to my actors) that will be more manageable for testing than having to deploy…
rebnat
  • 121
  • 9
1
vote
2 answers

Delete only field in elasticsearch using elastic4s

I want to delete only one particular field and value in elasticsearch using elastic4s library. However, all I see everywhere is different mechanisms to delete the whole document. Can anyone help? is this supported?
208rishabh
  • 96
  • 11
1
vote
2 answers

Searching for whole URL using elastic4s

I'm using elastic4s in order to index and search data in ES. Part of the document I'm storing contains a url field which I need to search for (the entire url). The problem occurs when I search for a document containing the url field and get 0…
anatolyr
  • 217
  • 1
  • 10
1
vote
1 answer

Build dynamically an elastic request with elastic4s

I would like to build a dynamic query in with elastic4s. I have a request object called myRequest with two fileds (fieldA and fieldB) Actually i build my query like this : val req = search in indexName -> indexType query { bool { …
hbellahc
  • 81
  • 1
  • 11
1
vote
1 answer

How to serialize elastic4s queries for reuse?

I'm using elastic4s to query elastic search, and now I need to cache this query to be used later for pagination purposes. The query built process is a heavy calculation that is why I need the final query it self save in some local cache (i.e redis)…
Sergio Santiago
  • 1,316
  • 1
  • 11
  • 19