Skip to content

Commit

Permalink
Update indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitali3 committed Oct 11, 2017
1 parent 0e7905c commit b1fbcef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/core/ESBase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ object ESBase {
}.await


def updateSingle[A <: ESEntity](a:A) = client.execute{
update(a.id).in("inq"/a.estype).doc(
a.fieldsAsMap
)
}.await



// val result = client.execute {
// search("myindex").matchQuery("capital", "ulaanbaatar")
// }.await
Expand Down
3 changes: 2 additions & 1 deletion app/core/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import com.sksamuel.elastic4s.http.HttpClient
import core.ESBase.client
import org.joda.time.DateTime
import services.model.Question
import services.model.Author

object Test {
def main(args:Array[String]) = {
ESBase.insert(Question(UUID.randomUUID(), UUID.randomUUID(), "Who are you?", Set.empty, new DateTime()))

ESBase.updateSingle(Question(UUID.fromString("4ca8feac-0cae-4c23-b762-66618e509859"),UUID.fromString("65bd81c2-ef85-4e71-b8f0-d76126a0f308"), "Iam",Set.empty,new DateTime()))
println("here!")
}
}

0 comments on commit b1fbcef

Please sign in to comment.