I am currently trying to build this function evaluation request using the elasticsearch Java API:
{ "query": { "function_score": { "functions": [ { "gauss": { "location": { "origin": { "lat": 52.55, "lon": 13.69 }, "offset": "30km", "scale": "10km", "decay": 0.9 } } }, { "gauss": { "createdAt": { "origin": "2015-06-14T15:50:00", "scale": "8h", "offset": "4h", "decay": 0.75 } } } ] } } }
But I can not find any documentation regarding java api and function evaluation requests. This is what I have so far:
elasticsearch.client .prepareSearch(config.offerIndex.value) .setQuery( QueryBuilders.functionScoreQuery( ScoreFunctionBuilders .gaussDecayFunction("location", ???, ???).setDecay(0.9) ) )
The second and third parameter of the gaussDecay function are called the initial and large-scale ones. But they have some type, and I have no idea how I should provide my location and time data. And the next question is how can I provide functions in FunctionScore Builder
source share