0

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
   {bool
     must (
       termsQuery ("myField" transformed (myListOfValues))
     )
   }
}

The method termsQuery is defined as follows in elastis4s

def termsQuery (field: String, capital gains: AnyRef *): TermsQueryDefinition

How can I turn my myListOfValues list to a AnyRef *

Thank you for your help.

hbellahc
  • 81
  • 1
  • 11

1 Answers1

0

You don't say what the type of ListOfValue is, but assuming its a Scala collection type, then you can do '_ : *' eg

termsQuery ("myField", transformed (myListOfValues) : _*)
sksamuel
  • 16,154
  • 8
  • 60
  • 108