# How to search/query on docs that have specific file size

**URL:** <https://discuss.elastic.co/t/how-to-search-query-on-docs-that-have-specific-file-size/153253>\
**Category:** Elasticsearch\
**Created:** [October 20, 2018, 4:27pm UTC](https://discuss.elastic.co/t/how-to-search-query-on-docs-that-have-specific-file-size/153253 "2018-10-20T16:27:27Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mohsen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohsen/32/42864_2.png) [@mohsen](https://discuss.elastic.co/u/mohsen)\
**Post date:** [October 21, 2018, 7:55am UTC](https://discuss.elastic.co/t/how-to-search-query-on-docs-that-have-specific-file-size/153253/4 "2018-10-21T07:55:01Z")

</div>

Thanks guys ...  
This link is also useful:  
[query-string-with-range](https://discuss.elastic.co/t/query-string-with-range/85111/2)

The query should be like this:

```
GET /_search
{
  "_source": [
    "file.*"
  ],
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "all"
          }
        },
        {
          "range": {
            "file.filesize": {
              "gte": 900,
              "lte": 100000
            }
          }
        }
      ]
    }
  },
  "sort": {
    "_score": {
      "order": "desc"
    }
  }
}
```

---

_[View the full topic](https://discuss.elastic.co/t/how-to-search-query-on-docs-that-have-specific-file-size/153253)._
