# Why match all and filter by username doesn't work for some usernames?

**URL:** <https://discuss.elastic.co/t/why-match-all-and-filter-by-username-doesnt-work-for-some-usernames/140800>\
**Category:** Elasticsearch\
**Created:** [July 19, 2018, 7:43pm UTC](https://discuss.elastic.co/t/why-match-all-and-filter-by-username-doesnt-work-for-some-usernames/140800 "2018-07-19T19:43:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shrimp-Fried-Rice](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shrimp-fried-rice/32/33360_2.png) [@Shrimp-Fried-Rice](https://discuss.elastic.co/u/Shrimp-Fried-Rice)\
**Post date:** [July 19, 2018, 7:43pm UTC](https://discuss.elastic.co/t/why-match-all-and-filter-by-username-doesnt-work-for-some-usernames/140800/1 "2018-07-19T19:43:43Z")

</div>

i am trying to use elasticsearch for matching username.

```
$params['body']['query']['bool']['must']['match_all'] = (object)[];
$params['body']['query']['bool']['filter']['term']['uploader'] = $_GET['uploader'];
$params['body']['sort']['upload_date']['order']= "desc" ;
$params['body']['from']	= 0;
$params['body']['size']	= 30;

```

i am doing it like this,.

match all documents and only get those which have username as i have specified using term filter

above query works for some usernames , but idk what happens when other usernames, it doesnt find the documents., even though there are documents., with uploader: username

or am i missing something ?

Thanks for your time.

my mapping is

```
{
	"mappings": {
    "content": { 
      "properties": { 
        "title":{ 
			"type": "text",
			"fields": {
				"raw": { 
					"type": "keyword"
				}
			}
		},
        "tags": { "type": "text" },
        "category": { "type": "keyword" },
        "sub_category":	{ "type": "keyword" },
        "size": { "type": "long" },
        "uploaders": { "type": "integer" },
        "downloaders": { "type": "integer" },
        "upload_date":	{
			"type": "date",
			"format": "yyyy-MM-dd HH:mm:ss"
        },
		"uploader":{
					"type": "text",
					"fields":	{
								"raw": { 
									"type": "keyword"
								}
					}
		}
      }
	}
  }
}
```

---

<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:** [August 16, 2018, 7:43pm UTC](https://discuss.elastic.co/t/why-match-all-and-filter-by-username-doesnt-work-for-some-usernames/140800/2 "2018-08-16T19:43:46Z")

</div>

Closed on August 16, 2018, 7:43pm UTC

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