# Clarification on path field

**URL:** <https://discuss.elastic.co/t/clarification-on-path-field/53611>\
**Category:** Elasticsearch\
**Created:** [June 22, 2016, 5:28am UTC](https://discuss.elastic.co/t/clarification-on-path-field/53611 "2016-06-22T05:28:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravi\_Shanker\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Ravi\_Shanker\_Reddy](https://discuss.elastic.co/u/Ravi_Shanker_Reddy)\
**Post date:** [June 22, 2016, 5:28am UTC](https://discuss.elastic.co/t/clarification-on-path-field/53611/1 "2016-06-22T05:28:40Z")

</div>

I am getting files from various paths for the same index. I want to filter based on the file path or file date. I am trying with wildcards, regex still its not working. Where I am missing... ?? I needed any format for the path???

`GET /my_store/products/_search { "query": { "wildcard": { "path": "/home/.*" } } }`

My path field id `"path": "/home/ES/CDR/Postpaid/SMSCDR_POSTPAID_160518080000_10.80.41.81_RS5.log"`. I want to search based on the hour. I tried this example [https://www.elastic.co/guide/en/elasticsearch/guide/current/\_wildcard\_and\_regexp\_queries.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/_wildcard_and_regexp_queries.html) but returing null.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 22, 2016, 5:37am UTC](https://discuss.elastic.co/t/clarification-on-path-field/53611/2 "2016-06-22T05:37:58Z")

</div>

In your example you're using a regexp pattern but the query says "wildcard". Have you tried using "regexp" there instead (or change the pattern to be a wildcard pattern)?

---

<div class="post-metadata">

**Author:** ![Ravi\_Shanker\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Ravi\_Shanker\_Reddy](https://discuss.elastic.co/u/Ravi_Shanker_Reddy)\
**Post date:** [June 22, 2016, 5:54am UTC](https://discuss.elastic.co/t/clarification-on-path-field/53611/3 "2016-06-22T05:54:34Z")

</div>

Can you please give one simple example for this...

I tried this also  
`GET _search { "query": { "regexp": { "path": "/home/.*" } } }`  
But this not working. So I created the index like  
`PUT /ravi { "settings": { "number_of_replicas": 0 }, "mappings": { "path" : { "properties" : { "path" : { "type" : "string", "index": "not_analyzed", "analyzer": "english" } } } } }`  
but still not working

---

<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 5, 2017, 10:41pm UTC](https://discuss.elastic.co/t/clarification-on-path-field/53611/4 "2017-07-05T22:41:31Z")

</div>


