# "index": "not\_analyzed" yet term filter still not working

**URL:** <https://discuss.elastic.co/t/index-not-analyzed-yet-term-filter-still-not-working/72704>\
**Category:** Elasticsearch\
**Created:** [January 24, 2017, 9:51pm UTC](https://discuss.elastic.co/t/index-not-analyzed-yet-term-filter-still-not-working/72704 "2017-01-24T21:51:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![klahnakoski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klahnakoski/32/3679_2.png) [@klahnakoski](https://discuss.elastic.co/u/klahnakoski)\
**Post date:** [January 24, 2017, 9:51pm UTC](https://discuss.elastic.co/t/index-not-analyzed-yet-term-filter-still-not-working/72704/1 "2017-01-24T21:51:42Z")

</div>

I am using Elasticsearch 1.7.1

I am interested in finding a task by `task.id`. The `task.id` property is `not_analyzed`, so this query should work, but it does not.

```
{"query":{"filtered":{"filter":{"or":[
    {"term":{"task.id":"ER70OtGBQla6YOW5qeivnw"}}
]}}},"from":0,"size":10}

```

results in

```
{
    "took":644,
    "timed_out":false,
    "_shards":{"total":30,"successful":30,"failed":0},
    "hits":{"total":0,"max_score":null,"hits":[]}
}

```

I have tried deleting the document and re-adding it. I forced a flush and a refresh multiple times.

What can be causing this? My index has about 100million documents (30 shards), and some non-trivial number of documents can not be found using `task.id`. Is it the nature of the values?

Thank you!

* * *

Here is some background

This query works

```
{"query":{"filtered":{"filter":{"or":[
    {"term":{"_id":"tc.480019:48001141.30"}},
    {"term":{"task.id":"ER70OtGBQla6YOW5qeivnw"}}
]}}},"from":0,"size":10}

```

and returns the following document (I chopped most of the properties in this example):

```
{
    "took": 516,
    "timed_out": false,
    "_shards": {"total": 30, "successful": 30, "failed": 0},
    "hits": {
        "total": 1,
        "max_score": 1,
        "hits": [{
            "_index": "task20170101_000000",
            "_type": "task",
            "_id": "tc.480019:48001141.30",
            "_score": 1,
            "_source": {
                "task": {
                    "signing": {"cert": [null]},
                    "features": ["taskclusterProxy", "relengAPIProxy", "chainOfTrust"],
                    "maxRunTime": 36000,
                    "image": {
                        "path": "public/image.tar.zst",
                        "type": "task-image",
                        "taskId": "ZqrJzMZ8QOOEoltAG7Y4JA"
                    },
                    "deadline": 1484417664.023,
                    "id": "ER70OtGBQla6YOW5qeivnw",
                    "group": {"id": "aEtr0ac7RA-qeANl9Sa63A"},
<CHOP>
                    "requires": "all-completed"
                },
<CHOP>
        }]
    }
}

```

Here is the schema (also chopped due to posting limits):

```
{
    "state": "open",
    "settings": {"index": {
        "refresh_interval": "600s",
        "number_of_shards": "30",
        "creation_date": "1483361238741",
        "recovery": {"initial_shards": "1"},
        "number_of_replicas": "2",
        "version": {"created": "1070199"},
        "uuid": "QxOeRX_gRYK74oOTh9IIdA"
    }},
    "mappings": {"task": {
        "_source": {"compress": true},
        "_id": {"index": "not_analyzed", "store": true},
        "dynamic_templates": [
            {"default_ids": {
                "mapping": {"index": "not_analyzed", "type": "string", "doc_values": true},
                "match": "id"
            }},
            {"default_strings": {
                "mapping": {"index": "not_analyzed", "type": "string", "doc_values": true},
                "match_mapping_type": "string",
                "match": "*"
            }},
            {"default_doubles": {
                "mapping": {"index": "not_analyzed", "type": "double", "doc_values": true},
                "match_mapping_type": "double",
                "match": "*"
            }},
            {"default_longs": {
                "match_pattern": "regex",
                "path_match": ".*",
                "mapping": {"index": "not_analyzed", "type": "long", "doc_values": true},
                "match_mapping_type": "long|integer"
            }}
        ],
        "_all": {"enabled": false},
        "properties": {
            "result": {"properties": {"missing_subtests": {"type": "boolean"}}},
            "resource_usage": {
                "dynamic": "true",
                "properties": {
                    "summary": {"dynamic": "true", "type": "nested"},
                    "samples": {"dynamic": "true", "type": "nested"}
                }
            },
            "task": {
                "dynamic": "true",
                "properties": {
                    "parent": {
                        "dynamic": "true",
                        "properties": {
                            "artifacts_url": {"index": "not_analyzed", "type": "string", "doc_values": true},
                            "id": {"index": "not_analyzed", "type": "string", "doc_values": true}
                        }
                    },
                    "expires": {"type": "double", "doc_values": true},
<CHOP>
                    "features": {"index": "not_analyzed", "type": "string", "doc_values": true},
                    "routes": {"index": "not_analyzed", "type": "string", "doc_values": true},
                    "id": {"index": "not_analyzed", "type": "string", "doc_values": true},
                    "state": {"index": "not_analyzed", "type": "string", "doc_values": true},
                    "deadline": {"type": "double", "doc_values": true},
<CHOP>
                    "requires": {"index": "not_analyzed", "type": "string", "doc_values": true}
                }
            },
<CHOP>
        }
    }},
    "aliases": ["task"]
}
```

---

<div class="post-metadata">

**Author:** ![klahnakoski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klahnakoski/32/3679_2.png) [@klahnakoski](https://discuss.elastic.co/u/klahnakoski)\
**Post date:** [January 30, 2017, 1:51am UTC](https://discuss.elastic.co/t/index-not-analyzed-yet-term-filter-still-not-working/72704/2 "2017-01-30T01:51:07Z")

</div>

It turns out the problem is with the search URL. If I use

```
http://activedata.allizom.org:9200/task/_search

```

I get the problem above. If I include the type, then the document gets returned:

```
http://activedata.allizom.org:9200/task/task/_search

```

This has ever been a problem before, and it is not a problem for all documents. I wonder if the alias name, type name, and top-level property name being all the same is a problem?

---

<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:** [February 27, 2017, 1:51am UTC](https://discuss.elastic.co/t/index-not-analyzed-yet-term-filter-still-not-working/72704/3 "2017-02-27T01:51:12Z")

</div>

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