# Comparison with elasticsearch

**URL:** https://discuss.elastic.co/t/comparison-with-elasticsearch/174869
**Category:** Elasticsearch
**Created:** [April 1, 2019, 8:27pm UTC](https://discuss.elastic.co/t/comparison-with-elasticsearch/174869 "2019-04-01T20:27:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mushishi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mushishi/32/43254_2.png) [@mushishi](https://discuss.elastic.co/u/mushishi)
#### Post date: [April 1, 2019, 8:27pm UTC](https://discuss.elastic.co/t/comparison-with-elasticsearch/174869/1 "2019-04-01T20:27:44Z")

</div>

Suppose I'm storing data in key, value format in a NoSQL database like MongoDB and I need to get all documents in which a value corresponding to a particular key is \<= some value. Is there a proper way of doing this query with elasticsearch?

For eg, I've documents:  
{A: 3, B:5}  
{A: 2, B:7}  
{A: 31, B:10}  
{A: 43, B:1} and I want documents with B \<= 5, so I get first and last documents.

I know there's a way to do this in MongoDB, but data size is very big (TBs) and I'm looking for a better performance, if there, is with elasticsearch. Thanks.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 1, 2019, 8:39pm UTC](https://discuss.elastic.co/t/comparison-with-elasticsearch/174869/2 "2019-04-01T20:39:08Z")

</div>

A range query should do that easily.

---

<div class="post-metadata">

### Author: ![mushishi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mushishi/32/43254_2.png) [@mushishi](https://discuss.elastic.co/u/mushishi)
#### Post date: [April 1, 2019, 8:55pm UTC](https://discuss.elastic.co/t/comparison-with-elasticsearch/174869/3 "2019-04-01T20:55:31Z")

</div>

Thanks for quick reply. I found gte, gt, lte, lt operators. I presume = and != correspond to must and must\_not?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 1, 2019, 9:15pm UTC](https://discuss.elastic.co/t/comparison-with-elasticsearch/174869/4 "2019-04-01T21:15:55Z")

</div>

Yes. Can be must or filter or should depending on what you want to do.

---

<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: [April 29, 2019, 9:16pm UTC](https://discuss.elastic.co/t/comparison-with-elasticsearch/174869/5 "2019-04-29T21:16:03Z")

</div>

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