# Inconsistent search results?

**URL:** https://discuss.elastic.co/t/inconsistent-search-results/26668
**Category:** Elasticsearch
**Created:** [July 31, 2015, 11:00pm UTC](https://discuss.elastic.co/t/inconsistent-search-results/26668 "2015-07-31T23:00:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![aarongu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aarongu/32/3626_2.png) [@aarongu](https://discuss.elastic.co/u/aarongu)
#### Post date: [July 31, 2015, 11:00pm UTC](https://discuss.elastic.co/t/inconsistent-search-results/26668/1 "2015-07-31T23:00:58Z")

</div>

Hello!

When I do this query:

```
  "query": {
    "simple_query_string": {
      "query": "[FSM:END]: certificates configuration(FSM:sam:dme:PkiEpUpdateEp)"
    }
  },
  "sort": {
    "time": {
      "order": "desc"
    }
  }
}

```

There are many hits as expected; Here is an example of one:  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/2/25b7b74a508c17077c4bfb71497ff8f2ab72bacd.PNG)

As you can see in the mapping "filename",there is "showcmds-policy-mgr.txt" to it.  
What I want to do is retrieve everything that has that specific filename. This is what I tried:

```
 {
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "bool": {
          "must": [
            {
              "term": {
                "filename": "showcmds-policy-mgr.txt"
              }
            }
          ]
        }
      }
    }
  },
  "sort": {
    "time": {
      "order": "desc"
    }
  }
}

```

This resulted in no hits. How exactly do I fix the second query to get the desired outcome?

Thanks,  
Aaron

---

<div class="post-metadata">

### Author: ![aarongu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aarongu/32/3626_2.png) [@aarongu](https://discuss.elastic.co/u/aarongu)
#### Post date: [July 31, 2015, 11:25pm UTC](https://discuss.elastic.co/t/inconsistent-search-results/26668/2 "2015-07-31T23:25:55Z")

</div>

I ended up figuring it out. I needed to add "index: not\_analyzed" to the mapping of filename.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [August 1, 2015, 5:20am UTC](https://discuss.elastic.co/t/inconsistent-search-results/26668/3 "2015-08-01T05:20:02Z")

</div>

Yep, because it'll split the field on the fullstop.

---

<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, 11:57pm UTC](https://discuss.elastic.co/t/inconsistent-search-results/26668/4 "2017-07-05T23:57:54Z")

</div>


