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

elastic4s geodistance sort query syntax

I am using elastic4s version 1.6.2 and need to write a query which searches for a given geo location, sorts results by distance and also returns the distance. I can do this using get request in curl but struggling to find the correct syntax and…
0
votes
1 answer

Use list of String as a parameter in elastic4s termsQuery

I use as elastic4s library to communicate with ElasticSearch. I would like to make an equivalent of "SELECT * FROM WHERE MY_INDEX MY_FIELD IN (VALUE_1, VALUE_2, ....)" I produced that query val req = search in indexName -> {query indexType   …
hbellahc
  • 81
  • 1
  • 11
0
votes
1 answer

update with script pre-installed in elasticsearch

I want to use scripts in the way[ https://www.elastic.co/blog/running-groovy-scripts-without-dynamic-scripting ] for security purpose. I tried this in sense(chrome plugin) and it works well. Wondering how to achieve this in elastic4s. For example,…
vincent chou
  • 91
  • 2
  • 8
0
votes
1 answer

can elasticsearch guarantee correctiveness when updating one doc at high frequency?

I have been working on a project which involves massive updates to elasticsearch and I found that when updating applied to one single doc at a high frequency, consistence can not be guaranteed. For each update, this is how we do(scala code). Notice…
vincent chou
  • 91
  • 2
  • 8
0
votes
1 answer

How do I implement a PatternAnalyzer in elastic4s and elasticsearch to exclude result with a certain field

I'm trying to perform a query on my index and get all reviews that do NOT have a reviewer with a gravatar image. To do this I have implemented a PatternAnalyzerDefinition with a host pattern: "^https?\\:\\/\\/([^\\/?#]+)(?:[\\/?#]|$)" that should…
jakob
  • 5,979
  • 7
  • 64
  • 103
0
votes
2 answers

Elasticsearch index array of made up of another class

I have a class which I want to begin indexing into ElasticSearch using the Scala client elastic4s. I have extended DocumentMap to allow me to insert the documents. The simple values like String, Int etc are working but I cannot seem to get a List of…
Darren
  • 795
  • 1
  • 6
  • 10
0
votes
1 answer

Elastic4s dependency to org.elasticsearch, can I get rid of it?

I just realized that elastic4s has a dependency to org.elasticsearch, and that dependency is downloading 20 Mb of library. For what I have seen in the github repo for elastic4s there are 66 references to the package org.elasticsearch in the code.…
Sal81
  • 101
  • 1
  • 1
  • 7
0
votes
2 answers

Invalid Json error when creating Elasticsearch index with elastic4s in play framework

I'm trying to create an index as shown before but I always get this error: Bad request For request 'POST /initIndex' [Invalid Json] I'm using elastic4s with play Framework 2.3.x and scala 2.11. import com.sksamuel.elastic4s.{ElasticClient,…
Marouane Gazanayi
  • 5,063
  • 6
  • 39
  • 58
0
votes
1 answer

Using elastic4s for GeoDistance queries

I'm having some trouble understanding the DSL syntax for forming GeoDistance queries (get all entries within a certain distance from a point); Currently, in my ES index "places" -> "shops" with id = 1 I have a sample entry; { _index: "places", …
Ashesh
  • 2,978
  • 4
  • 27
  • 47
0
votes
1 answer

Index nested object with DocumentMap

Im trying to create bulk index by using DocumentMap . i map the classes like that case class Comment(id: String, fromId: String, fromName: String, message: String, creationTime: String, likeCount: Int =0) extends DocumentMap { def map =…
MIkCode
  • 2,655
  • 5
  • 28
  • 46
-1
votes
1 answer

How to create query in Elastic4s

I'm implement query in Elastic4s library. But I don't know how to implement a following Json query for Elasticsearch. { "bool": { "must": [ { "match_all": {} }, { "keywordQuery": "hogehoge" …
1 2 3
10
11