# Search data for each date

**URL:** https://discuss.elastic.co/t/search-data-for-each-date/203233
**Category:** Elasticsearch
**Created:** [October 11, 2019, 11:52am UTC](https://discuss.elastic.co/t/search-data-for-each-date/203233 "2019-10-11T11:52:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![NAL](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@NAL](https://discuss.elastic.co/u/NAL)
#### Post date: [October 11, 2019, 11:52am UTC](https://discuss.elastic.co/t/search-data-for-each-date/203233/1 "2019-10-11T11:52:07Z")

</div>

Hello,

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)

```auto
  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) }))
                                                                                            .Query(
           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))));

```

---

<div class="post-metadata">

### Author: ![NAL](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@NAL](https://discuss.elastic.co/u/NAL)
#### Post date: [October 16, 2019, 9:05am UTC](https://discuss.elastic.co/t/search-data-for-each-date/203233/2 "2019-10-16T09:05:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 13, 2019, 9:05am UTC](https://discuss.elastic.co/t/search-data-for-each-date/203233/3 "2019-11-13T09:05:52Z")

</div>

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