# Multiple date fields, cannot filter time

**URL:** https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347
**Category:** Kibana
**Created:** [August 13, 2015, 9:05pm UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347 "2015-08-13T21:05:55Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![inlikefletch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inlikefletch/32/4834_2.png) [@inlikefletch](https://discuss.elastic.co/u/inlikefletch)
#### Post date: [August 13, 2015, 9:05pm UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347/1 "2015-08-13T21:05:55Z")

</div>

I have a database that has multiple data fields. A date field when published, and date fields for start and stop times tracking total times of the transaction. In kibana, i notice the default discover page does not have a small histogram at the top, and when i build dashboards, I cannot filter the time, it just shows all my events. Do I have to tell elasticsearch a default date field?

---

<div class="post-metadata">

### Author: ![Joshua\_Rich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rich/32/44953_2.png) [@Joshua\_Rich](https://discuss.elastic.co/u/Joshua_Rich)
#### Post date: [August 14, 2015, 12:05am UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347/2 "2015-08-14T00:05:52Z")

</div>

This sounds like those fields aren't mapping to a date type properly (possibly they are just mapped as strings). Can you check your mapping to make sure those fields have `type: date`?

---

<div class="post-metadata">

### Author: ![inlikefletch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inlikefletch/32/4834_2.png) [@inlikefletch](https://discuss.elastic.co/u/inlikefletch)
#### Post date: [August 14, 2015, 1:05pm UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347/3 "2015-08-14T13:05:44Z")

</div>

No, they are definitely mapped as type date. I noticed on my other data, that only have one date type field, that in settings, indices, and by field name, it has a little clock icon, that when I mouse over, it says, "This field represent the time that events occurred".

My new data, does not have a field that has that icon.

---

<div class="post-metadata">

### Author: ![inlikefletch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inlikefletch/32/4834_2.png) [@inlikefletch](https://discuss.elastic.co/u/inlikefletch)
#### Post date: [August 14, 2015, 1:27pm UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347/4 "2015-08-14T13:27:56Z")

</div>

I did just figure out if i create the index from kibana, rather than my curl mapping statements, I can select a "time field name". Is there a way I can assign that via curl mappings?

---

<div class="post-metadata">

### Author: ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)
#### Post date: [August 14, 2015, 5:25pm UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347/5 "2015-08-14T17:25:09Z")

</div>

Could you share your curl mapping statements?

---

<div class="post-metadata">

### Author: ![inlikefletch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inlikefletch/32/4834_2.png) [@inlikefletch](https://discuss.elastic.co/u/inlikefletch)
#### Post date: [August 21, 2015, 12:05pm UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347/6 "2015-08-21T12:05:29Z")

</div>

Here are my curl/invoke statements. They are in powershell format:

Invoke-RestMethod [http://localhost:9200/m1aps](http://localhost:9200/m1aps) -Method Delete  
Invoke-RestMethod [http://localhost:9200/m1aps](http://localhost:9200/m1aps) -Method Put  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"APSOperations":{"properties":{"Published":{"type":"date","format":"MM/dd/yyyy HH:mm:ss"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"APSOperations":{"properties":{"StartTime":{"type":"date","format":"MM/dd/yyyy HH:mm:ss"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"APSOperations":{"properties":{"StopTime":{"type":"date","format":"MM/dd/yyyy HH:mm:ss"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"APSOperations":{"properties":{"insDt":{"type":"date","format":"yyyy-MM-dd HH:mm:ss.SSS||MM/dd/yyyy HH:mm:ss||MM/dd/yyyy hh:mm:ss aa"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"Text":{"type":"string","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"SuspectMessage":{"type":"string","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"SuspectMessageType":{"type":"string","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"TotalTimeInSeconds":{"type":"integer","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"Ticks":{"type":"integer","index":"not\_analyzed","store":true}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"EligibilityStatus":{"type":"string","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"MessageTypeName":{"type":"string","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"SerializedMessage":{"type":"string","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"StackTrace":{"type":"string","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"SuspectMessage":{"type":"string","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"SuspectMessageType":{"type":"string","index":"not\_analyzed"}}}}'  
Invoke-RestMethod [http://localhost:9200/m1aps/\_mapping/ApsOperations?ignore\_conflicts=true](http://localhost:9200/m1aps/_mapping/ApsOperations?ignore_conflicts=true) -Method Put -Body '{"ApsOperations":{"properties":{"Payer":{"type":"string","index":"not\_analyzed"}}}}'

I think I got it now by selecting the time field name in kibana index settings, but I am still trying to figure out the following:

1. how to modify my curl mapping statements to handle date type if value is null
2. how to complete delete/remove documents with a specific field name

---

<div class="post-metadata">

### Author: ![shrewn](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@shrewn](https://discuss.elastic.co/u/shrewn)
#### Post date: [July 11, 2016, 10:45am UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347/7 "2016-07-11T10:45:49Z")

</div>

Did you resolve this? My data has multiple fields with type date too and when I create the index-pattern in kibana I don't get any of these options in the drop down and I am hence unable to filter on time in my graphs and dashboard. I think it is a similar issue so did you solve this - could you let me know how?

---

<div class="post-metadata">

### Author: ![inlikefletch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inlikefletch/32/4834_2.png) [@inlikefletch](https://discuss.elastic.co/u/inlikefletch)
#### Post date: [July 11, 2016, 4:18pm UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347/8 "2016-07-11T16:18:00Z")

</div>

I don't remember. But I think it is easier to have indexes and mappings defined prior to inserting any data. Use of templates is great too, but I am not very knowledgeable in creating them yet.

---

<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: [July 6, 2017, 1:47pm UTC](https://discuss.elastic.co/t/multiple-date-fields-cannot-filter-time/27347/9 "2017-07-06T13:47:18Z")

</div>


