Search data for each date


I have somes index with data containing a date field, a geo_point field and a value field.

I develop a method with c# and NEST.

It must be able to search values corresponding to a geo point and a date a multiple time.
So, I have a search request foreach geo_point, for this geo_point, I have multiple date to search on.

I saw that with DateRange, we can ask for a range, but how must I do to search for every exact date I have for each geo point ?

I tried with the .Terms method but doesn't return me anything.
Do you have some advise to have the most fastest result.

Thank you.

Here is my request : (times variable is List)

  var searchResults = client.Search<dynamic>(s => s.AllIndices().From(0).Size(1000).ScriptFields(sf => sf.ScriptField("distance", d => d.Source("if(doc['geo'].size() > 0) { doc['geo'].arcDistance(" + lat.ToString().Replace(',', '.') + "," + lon.ToString().Replace(',', '.') + ")}")))
                                                                                            .DocValueFields(l => l.Fields(new List<Field>() { new Field("value", null, null), new Field("geo", null, null), new Field("date", null, null) }))
           q => q.Bool(
           b => b.Must(
                    //n => n.Field("forecastDate").Query())).Filter(
                    f => f.GeoDistance(
                     g => g.Distance(distance, DistanceUnit.Meters).DistanceType(GeoDistanceType.Arc).Field("geo").Location(lat, lon))) 
                     ) && q.Terms(t => t.Field("date").Terms(times))));

I wrote the request with Kibana console with aggregation and use the low level API to execute it.
The low lvl api is really more efficient.

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