Multisearch with array params

Hello,

I want to use multisearch request to search for multiple geo_point.
My problem is that I want to pass an array as parameter in "term" node but it doesn't works.
I use a template :

POST /_scripts/my_template_3
{
  "script": {
    "lang": "mustache",
    "source": "{\"size\": 0,\"query\": {\"bool\": {\"must\": {\"terms\": {{#toJson}}dates{{/toJson}}}}},\"aggs\": {\"bydate\": {\"terms\": {\"field\": \"datefield\"},\"aggs\": {\"byindex\": {\"terms\": {\"field\": \"_index\"},\"aggs\": {\"top\": {\"top_hits\": {\"sort\": [{\"_geo_distance\": {\"geo\": {\"lat\": 42.1,\"lon\": -158.375},\"order\": \"asc\",\"unit\": \"m\",\"distance_type\": \"arc\"}}],\"size\": 1}}}}}}}}"
  }
}

And here my call :

{ "index": "name" }
{"id":"my_template_3", "params": {{ "dates":{"datefield": ["2019-07-27T12:00:00", "2019-07-27T18:00:00Z", "2019-07-27T19:00:00Z" ]}}}}

Thank you.

Ok, I have resolve my problem.
That was a syntax error

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.