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 the client using a simple remote url
val client = ElasticClient.remote("localhost", 9300)
"title" -> title,
"uid" -> uid
could not find implicit value for parameter executable: com.sksamuel.elastic4s.Executable[com.sksamuel.elastic4s.IndexDefinition,R,Q]
This appears to be caused because I was not doing a full import of ElasticDsl as follows
but instead doing
When importing the full object, it clearly invokes the companion objects, including the implicits needed.
The reason for not doing a full import, was because the DSL for elastic was clashing with the DSL for Anorm, so by extracting the Elastic code to a separate function, and using the import inside of the function definition, the ambiguity was removed and the code was able to compile.