# How to query the elastic search using node js client

**URL:** <https://discuss.elastic.co/t/how-to-query-the-elastic-search-using-node-js-client/210221>\
**Category:** Elasticsearch\
**Created:** [December 2, 2019, 5:09pm UTC](https://discuss.elastic.co/t/how-to-query-the-elastic-search-using-node-js-client/210221 "2019-12-02T17:09:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sagar\_patil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_patil/32/51529_2.png) [@sagar\_patil](https://discuss.elastic.co/u/sagar_patil)\
**Post date:** [December 2, 2019, 5:09pm UTC](https://discuss.elastic.co/t/how-to-query-the-elastic-search-using-node-js-client/210221/1 "2019-12-02T17:09:02Z")

</div>

I am new to elastic search I tried some queries,can please any one help me to get the unique users for that Audi and bmw keyword.

```auto
"query": {
 "bool": {
     "must": [
     {
       "term": {
         "keyword": "Audi"
       }
     },
     {
       "term": {
         "keyword": "BMW"
       }
     },
     {
       "range": {
         "date": {
             "gte": "2019-11-19",
             "lt": "2019-11-29"
         }
       }
     }
   ]
 }
}
}

```

I need the result like below.  
 ![Screenshot_2019-12-02%20Fwd%20Search%20UI%20for%20audience%20builder%20-%20sagar%20wandx%20co%20-%20WandX%20Mail](https://us1.discourse-cdn.com/elastic/original/3X/a/1/a11292085f660a460c85b2c5eff65611bd4601d0.png)

this is index.  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/1/c1aa956ede88c6dd57618424461de9dd3443c9da.png) timeStamp uuid title  
1573312002664.29 7d274130-0454-11ea-9510-2b740802bf11 Audi R8  
1573312002664.29 7d274130-0454-11ea-9510-2b740802bf11 bmw dynamic  
1573025285760.51 7d274130-0454-11ea-9510-2b740802bf11 audi A4  
1573025285760.51 7d274130-0454-11ea-9510-2b740802bf11 Audi vs Bmw  
1573025285760.51 7d274130-0454-11ea-9510-2b740802bf11 price of BMW 3 series starting price

---

<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:** [December 3, 2019, 8:23am UTC](https://discuss.elastic.co/t/how-to-query-the-elastic-search-using-node-js-client/210221/2 "2019-12-03T08:23:27Z")

</div>

May be look at [Terms Aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html)?

---

<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:** [December 31, 2019, 8:23am UTC](https://discuss.elastic.co/t/how-to-query-the-elastic-search-using-node-js-client/210221/3 "2019-12-31T08:23:27Z")

</div>

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