# Can ES do the following?

**URL:** <https://discuss.elastic.co/t/can-es-do-the-following/3563>\
**Category:** Elasticsearch\
**Created:** [November 12, 2010, 3:41pm UTC](https://discuss.elastic.co/t/can-es-do-the-following/3563 "2010-11-12T15:41:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jondow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jondow/32/2111_2.png) [@Jondow](https://discuss.elastic.co/u/Jondow)\
**Post date:** [November 12, 2010, 3:41pm UTC](https://discuss.elastic.co/t/can-es-do-the-following/3563/1 "2010-11-12T15:41:27Z")

</div>

In evaluating ES as a replacement for our current brute force SQL  
search strategy, I need to verify that I can do the following searches  
in ES (although I realize this perhaps relates more to Lucene?).

When searching on string value columns in the DB, we offer the  
following in our search interface:

1. Contains any of - this is a whitespace tokenizer search that does  
an OR between the various tokens
2. Contains all of - this is a whitespace tokenizer search that does  
an AND between the various tokens
3. Contains exactly - this is a whitespace tokenizer that checks that  
the entire column value matches exactly the token given
4. Does not contain - this is a whitespace tokenizer that ensures that  
an entity does not contain the given value

#'s 3 and 4 are the main ones I need to verify here. Will those  
searches be possible in Lucene vernacular, via ES?

thanks,  
Darryl

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [November 12, 2010, 3:51pm UTC](https://discuss.elastic.co/t/can-es-do-the-following/3563/2 "2010-11-12T15:51:26Z")

</div>

On Fri, 2010-11-12 at 07:41 -0800, Jondow wrote:

> In evaluating ES as a replacement for our current brute force SQL  
> search strategy, I need to verify that I can do the following searches  
> in ES (although I realize this perhaps relates more to Lucene?).

Yes you can

> 1. Contains any of - this is a whitespace tokenizer search that does  
> an OR between the various tokens
> 2. Contains all of - this is a whitespace tokenizer search that does  
> an AND between the various tokens
> 3. Contains exactly - this is a whitespace tokenizer that checks that  
> the entire column value matches exactly the token given
> 4. Does not contain - this is a whitespace tokenizer that ensures that  
> an entity does not contain the given value

"(some of me) AND must AND have AND this AND "exactly this" NOT excluded"

That's the basic query syntax. On top of that you have and|or|not  
filters that you could use on terms that are not analyzed  
(eg status: published, user\_id: 123 etc)

See here for more:  
[http://www.elasticsearch.com/docs/elasticsearch/rest\_api/query\_dsl/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/)

clint

---

<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:** [July 6, 2017, 4:16am UTC](https://discuss.elastic.co/t/can-es-do-the-following/3563/3 "2017-07-06T04:16:37Z")

</div>

Closed on July 6, 2017, 4:16am UTC


