# How to search data in where condition

**URL:** <https://discuss.elastic.co/t/how-to-search-data-in-where-condition/82258>\
**Category:** Elasticsearch\
**Created:** [April 13, 2017, 8:23am UTC](https://discuss.elastic.co/t/how-to-search-data-in-where-condition/82258 "2017-04-13T08:23:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sharon\_wsf](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@Sharon\_wsf](https://discuss.elastic.co/u/Sharon_wsf)\
**Post date:** [April 13, 2017, 8:23am UTC](https://discuss.elastic.co/t/how-to-search-data-in-where-condition/82258/1 "2017-04-13T08:23:15Z")

</div>

Hi Team,

How to search as below condition when need search all without any key  
" select \* from XXX where header like '% abc%' '  
for example:  
i need to query all result, but if same ID ( same id like 'urn\_newsml\_reuters.com\_20170413\_nL8N1HL0Y7' and 'urn\_newsml\_reuters.com\_20170413\_nL8N1HL0Y7\_abc') mean is one is general, another ones is for another purpose, the different is \_XXX at behind), it only need show one.  
my current code only

```
POST /news/ { "query": { "bool": { "must": [{ "range": { "CDate": { "gt": "2017-04-13T15:54:07" , "lte": "2017-04-13T23:59:59" } } }] } }, "from": 0, "size": 100, "sort": [{ "CDate": { "order": "desc" } }] }

```

this query only can search all, please kindly advice how to query as i told at above?

thanks and best regards  
Sharon

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [April 21, 2017, 7:29am UTC](https://discuss.elastic.co/t/how-to-search-data-in-where-condition/82258/2 "2017-04-21T07:29:55Z")

</div>

sorry Sharon, your problem description doesn't make sense to me. Can you provide concrete examples of docs you want to match and what not?

---

<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:** [May 19, 2017, 7:36am UTC](https://discuss.elastic.co/t/how-to-search-data-in-where-condition/82258/3 "2017-05-19T07:36:17Z")

</div>

Closed on May 19, 2017, 7:36am UTC

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