how I can create the query with client elastic4s scala?
I call using marvel/sense
GET /business/_search
{
"query": {
"function_score": {
"query": {
"match": {
"name": "my text"
}
},
"script_score": {
"script": "_score + log(doc['reviews'].value + 1 )",
"lang": "groovy"
}
}
},
"facets": {
"industry": {
"terms": {
"fields": ["type", "industry"]
}
}
},
"size": 10
}
But how I can create the query with elastic4s?
You can do a function score query like this:
val req = search in "marvel/sense" query {
functionScoreQuery(matchQuery("name", "my_text")).scorers(
scriptScore("_score + log(doc['reviews'].value + 1 )")
)
}
Then of course add in the facets, etc following the instructions at https://github.com/sksamuel/elastic4s/blob/master/guide/search.md