# Which query is the best for standard searching?

**URL:** https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194
**Category:** Elasticsearch
**Created:** [June 22, 2012, 12:49pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194 "2012-06-22T12:49:57Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [June 22, 2012, 12:49pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/1 "2012-06-22T12:49:57Z")

</div>

I'm using ElasticSearch as a database for long text's to search their  
content. Which query with what parameters will be the best for  
standard text searching, the google kind of search etc. so I'm  
entering a string, phrase whatever the user can try to look for and  
finding best results with some similarity rule

---

<div class="post-metadata">

### Author: ![Nick\_Dunn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_dunn/32/2315_2.png) [@Nick\_Dunn](https://discuss.elastic.co/u/Nick_Dunn)
#### Post date: [June 23, 2012, 9:07am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/2 "2012-06-23T09:07:03Z")

</div>

query\_string.

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [June 23, 2012, 11:26am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/3 "2012-06-23T11:26:36Z")

</div>

what configuration should I use for best performance of searching?

On 23 Cze, 11:07, Nick Dunn [n...@nick-dunn.co.uk](mailto:n...@nick-dunn.co.uk) wrote:

> query\_string.

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [June 29, 2012, 11:21am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/4 "2012-06-29T11:21:39Z")

</div>

anyone? I'm looking for best configuration of query\_string for  
searching results?

---

<div class="post-metadata">

### Author: ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)
#### Post date: [June 29, 2012, 11:28am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/5 "2012-06-29T11:28:28Z")

</div>

Hello!

Its hard to give a general query that will work in all situations, I  
don't think it's even possible. You should think what fields in your  
index are important to you (and use boosting on those), you should  
think if you want phrase queries to be used to boost documents that  
have them present. You may also want to have some fields boost score  
of your documents (for example number of likes or recent date) so you  
may want to use custom score query. And many, many more 'You may'.

You should think what you want Elasticsearch to return and how and  
this way construct your queries.

--  
Regards,  
Rafał Kuć  
Sematext :: [http://sematext.com/](http://sematext.com/) :: Solr - Lucene - Nutch - Elasticsearch

> anyone? I'm looking for best configuration of query\_string for  
> searching results?

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [June 29, 2012, 11:52am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/6 "2012-06-29T11:52:45Z")

</div>

Heh yeah I know that it's kind of problem with answers like "you can  
or you can or you can" and it all depends on what you need... problem  
is that it's hard to start using this search engine because of lack of  
documentation tuts etc

I would like to use it only in one case I'm searching the documents  
using only one field always and I want to build the most standard  
search engine for frazes that will return results from best similarity  
to lower and so on...

so if I have a fraze like "AAA BBB CCC" search results will be like:

AAA BBB CCC

AAX BBB CCC

AAA BBB

AAX BBB

AAA

AAX

On 29 Cze, 13:28, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:

> Hello!
> 
> Its hard to give a general query that will work in all situations, I  
> don't think it's even possible. You should think what fields in your  
> index are important to you (and use boosting on those), you should  
> think if you want phrase queries to be used to boost documents that  
> have them present. You may also want to have some fields boost score  
> of your documents (for example number of likes or recent date) so you  
> may want to use custom score query. And many, many more 'You may'.
> 
> You should think what you want Elasticsearch to return and how and  
> this way construct your queries.
> 
> --  
> Regards,  
> Rafa³ Kuæ  
> Sematext ::[http://sematext.com/::](http://sematext.com/::) Solr - Lucene - Nutch - Elasticsearch
> 
> > anyone? I'm looking for best configuration of query\_string for  
> > searching results?

---

<div class="post-metadata">

### Author: ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)
#### Post date: [June 29, 2012, 12:07pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/7 "2012-06-29T12:07:43Z")

</div>

Hello!

Use boolean query with OR to get all documents with at least one term,  
than use phrase query to boost the documents that have the words close  
to each other (look at the phrase sloop to see how you control that)  
and finally use boosting query to boost the documents that have all  
the terms in the field you are searching on. Of course all of that  
should be combined into a single query for Elasticsearch to do all the  
score calculation for you.

I don't know what you want to achieve when you say you want to have  
results of 'AAX' when querying for 'AAA'.

--  
Regards,  
Rafał Kuć  
Sematext :: [http://sematext.com/](http://sematext.com/) :: Solr - Lucene - Nutch - Elasticsearch

> Heh yeah I know that it's kind of problem with answers like "you can  
> or you can or you can" and it all depends on what you need... problem  
> is that it's hard to start using this search engine because of lack of  
> documentation tuts etc

> I would like to use it only in one case I'm searching the documents  
> using only one field always and I want to build the most standard  
> search engine for frazes that will return results from best similarity  
> to lower and so on...

> so if I have a fraze like "AAA BBB CCC" search results will be like:

> AAA BBB CCC

> AAX BBB CCC

> AAA BBB

> AAX BBB

> AAA

> AAX

> On 29 Cze, 13:28, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> 
> > Hello!
> > 
> > Its hard to give a general query that will work in all situations, I  
> > don't think it's even possible. You should think what fields in your  
> > index are important to you (and use boosting on those), you should  
> > think if you want phrase queries to be used to boost documents that  
> > have them present. You may also want to have some fields boost score  
> > of your documents (for example number of likes or recent date) so you  
> > may want to use custom score query. And many, many more 'You may'.
> > 
> > You should think what you want Elasticsearch to return and how and  
> > this way construct your queries.
> > 
> > --  
> > Regards,  
> > Rafa³ Kuæ  
> > Sematext ::[http://sematext.com/::](http://sematext.com/::) Solr - Lucene - Nutch - Elasticsearch
> > 
> > > anyone? I'm looking for best configuration of query\_string for  
> > > searching results?

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [June 29, 2012, 12:16pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/8 "2012-06-29T12:16:21Z")

</div>

AAX -\> AAA I meant similarity so when I will write CAT I will always  
fins CATS etc.

On 29 Cze, 14:07, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:

> Hello!
> 
> Use boolean query with OR to get all documents with at least one term,  
> than use phrase query to boost the documents that have the words close  
> to each other (look at the phrase sloop to see how you control that)  
> and finally use boosting query to boost the documents that have all  
> the terms in the field you are searching on. Of course all of that  
> should be combined into a single query for Elasticsearch to do all the  
> score calculation for you.
> 
> I don't know what you want to achieve when you say you want to have  
> results of 'AAX' when querying for 'AAA'.
> 
> --  
> Regards,  
> Rafał Kuć  
> Sematext ::[http://sematext.com/::](http://sematext.com/::) Solr - Lucene - Nutch - Elasticsearch
> 
> > Heh yeah I know that it's kind of problem with answers like "you can  
> > or you can or you can" and it all depends on what you need... problem  
> > is that it's hard to start using this search engine because of lack of  
> > documentation tuts etc  
> > I would like to use it only in one case I'm searching the documents  
> > using only one field always and I want to build the most standard  
> > search engine for frazes that will return results from best similarity  
> > to lower and so on...  
> > so if I have a fraze like "AAA BBB CCC" search results will be like:  
> > AAA BBB CCC  
> > AAX BBB CCC  
> > AAA BBB  
> > AAX BBB  
> > AAA  
> > AAX  
> > On 29 Cze, 13:28, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > 
> > > Hello!
> 
> > > Its hard to give a general query that will work in all situations, I  
> > > don't think it's even possible. You should think what fields in your  
> > > index are important to you (and use boosting on those), you should  
> > > think if you want phrase queries to be used to boost documents that  
> > > have them present. You may also want to have some fields boost score  
> > > of your documents (for example number of likes or recent date) so you  
> > > may want to use custom score query. And many, many more 'You may'.
> 
> > > You should think what you want Elasticsearch to return and how and  
> > > this way construct your queries.
> 
> > > --  
> > > Regards,  
> > > Rafa³ Kuæ  
> > > Sematext ::[http://sematext.com/::Solr](http://sematext.com/::Solr) - Lucene - Nutch - Elasticsearch
> 
> > > > anyone? I'm looking for best configuration of query\_string for  
> > > > searching results?

---

<div class="post-metadata">

### Author: ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)
#### Post date: [June 29, 2012, 12:21pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/9 "2012-06-29T12:21:58Z")

</div>

Hello!

You mean that when you type in plural form, you also find singular and  
all the cases like buy, bought should be find when typing buy ? Then  
you also should look at analysis, because its a matter of the correct  
language analysis:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

.

--  
Regards,  
Rafał Kuć  
Sematext :: [http://sematext.com/](http://sematext.com/) :: Solr - Lucene - Nutch - Elasticsearch

AAX -\>\> AAA I meant similarity so when I will write CAT I will always

> fins CATS etc.

> On 29 Cze, 14:07, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> 
> > Hello!
> > 
> > Use boolean query with OR to get all documents with at least one term,  
> > than use phrase query to boost the documents that have the words close  
> > to each other (look at the phrase sloop to see how you control that)  
> > and finally use boosting query to boost the documents that have all  
> > the terms in the field you are searching on. Of course all of that  
> > should be combined into a single query for Elasticsearch to do all the  
> > score calculation for you.
> > 
> > I don't know what you want to achieve when you say you want to have  
> > results of 'AAX' when querying for 'AAA'.
> > 
> > --  
> > Regards,  
> > Rafał Kuć  
> > Sematext ::[http://sematext.com/::](http://sematext.com/::) Solr - Lucene - Nutch - Elasticsearch
> > 
> > > Heh yeah I know that it's kind of problem with answers like "you can  
> > > or you can or you can" and it all depends on what you need... problem  
> > > is that it's hard to start using this search engine because of lack of  
> > > documentation tuts etc  
> > > I would like to use it only in one case I'm searching the documents  
> > > using only one field always and I want to build the most standard  
> > > search engine for frazes that will return results from best similarity  
> > > to lower and so on...  
> > > so if I have a fraze like "AAA BBB CCC" search results will be like:  
> > > AAA BBB CCC  
> > > AAX BBB CCC  
> > > AAA BBB  
> > > AAX BBB  
> > > AAA  
> > > AAX  
> > > On 29 Cze, 13:28, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > 
> > > > Hello!
> > 
> > > > Its hard to give a general query that will work in all situations, I  
> > > > don't think it's even possible. You should think what fields in your  
> > > > index are important to you (and use boosting on those), you should  
> > > > think if you want phrase queries to be used to boost documents that  
> > > > have them present. You may also want to have some fields boost score  
> > > > of your documents (for example number of likes or recent date) so you  
> > > > may want to use custom score query. And many, many more 'You may'.
> > 
> > > > You should think what you want Elasticsearch to return and how and  
> > > > this way construct your queries.
> > 
> > > > --  
> > > > Regards,  
> > > > Rafa³ Kuæ  
> > > > Sematext ::[http://sematext.com/::Solr](http://sematext.com/::Solr) - Lucene - Nutch - Elasticsearch
> > 
> > > > > anyone? I'm looking for best configuration of query\_string for  
> > > > > searching results?

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [June 29, 2012, 12:27pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/10 "2012-06-29T12:27:06Z")

</div>

Something like this, mayby not so much like finding bought when typing  
buy, but I'm searching in our beautifull Polish language 🙂 so when I  
will tyle "szkolenie" I would also want to find "szkoleń",  
"szkoleniowy", "szkolenia" and so on...

On 29 Cze, 14:21, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:

> Hello!
> 
> You mean that when you type in plural form, you also find singular and  
> all the cases like buy, bought should be find when typing buy ? Then  
> you also should look at analysis, because its a matter of the correct  
> language analysis:[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/l)...  
> .
> 
> --  
> Regards,  
> Rafał Kuć  
> Sematext ::[http://sematext.com/::](http://sematext.com/::) Solr - Lucene - Nutch - Elasticsearch
> 
> AAX -\>\> AAA I meant similarity so when I will write CAT I will always
> 
> > fins CATS etc.  
> > On 29 Cze, 14:07, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > 
> > > Hello!
> 
> > > Use boolean query with OR to get all documents with at least one term,  
> > > than use phrase query to boost the documents that have the words close  
> > > to each other (look at the phrase sloop to see how you control that)  
> > > and finally use boosting query to boost the documents that have all  
> > > the terms in the field you are searching on. Of course all of that  
> > > should be combined into a single query for Elasticsearch to do all the  
> > > score calculation for you.
> 
> > > I don't know what you want to achieve when you say you want to have  
> > > results of 'AAX' when querying for 'AAA'.
> 
> > > --  
> > > Regards,  
> > > Rafał Kuć  
> > > Sematext ::[http://sematext.com/::Solr](http://sematext.com/::Solr) - Lucene - Nutch - Elasticsearch
> 
> > > > Heh yeah I know that it's kind of problem with answers like "you can  
> > > > or you can or you can" and it all depends on what you need... problem  
> > > > is that it's hard to start using this search engine because of lack of  
> > > > documentation tuts etc  
> > > > I would like to use it only in one case I'm searching the documents  
> > > > using only one field always and I want to build the most standard  
> > > > search engine for frazes that will return results from best similarity  
> > > > to lower and so on...  
> > > > so if I have a fraze like "AAA BBB CCC" search results will be like:  
> > > > AAA BBB CCC  
> > > > AAX BBB CCC  
> > > > AAA BBB  
> > > > AAX BBB  
> > > > AAA  
> > > > AAX  
> > > > On 29 Cze, 13:28, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > > 
> > > > > Hello!
> 
> > > > > Its hard to give a general query that will work in all situations, I  
> > > > > don't think it's even possible. You should think what fields in your  
> > > > > index are important to you (and use boosting on those), you should  
> > > > > think if you want phrase queries to be used to boost documents that  
> > > > > have them present. You may also want to have some fields boost score  
> > > > > of your documents (for example number of likes or recent date) so you  
> > > > > may want to use custom score query. And many, many more 'You may'.
> 
> > > > > You should think what you want Elasticsearch to return and how and  
> > > > > this way construct your queries.
> 
> > > > > --  
> > > > > Regards,  
> > > > > Rafa³ Kuæ  
> > > > > Sematext ::[http://sematext.com/::Solr-](http://sematext.com/::Solr-) Lucene - Nutch - Elasticsearch
> 
> > > > > > anyone? I'm looking for best configuration of query\_string for  
> > > > > > searching results?

---

<div class="post-metadata">

### Author: ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)
#### Post date: [June 29, 2012, 12:36pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/11 "2012-06-29T12:36:02Z")

</div>

Hello!

There are two plugins for Polish for Elasticsearch. One can be found  
here:

> **[GitHub - elastic/elasticsearch-analysis-stempel: Stempel (Polish) Analysis...](https://github.com/elastic/elasticsearch-analysis-stempel)**
>
> Stempel (Polish) Analysis Plugin for Elasticsearch - GitHub - elastic/elasticsearch-analysis-stempel: Stempel (Polish) Analysis Plugin for Elasticsearch

and the second one is here:

> **[GitHub - monterail/elasticsearch-analysis-morfologik: Morfologik (Polish)...](https://github.com/monterail/elasticsearch-analysis-morfologik)**
>
> Morfologik (Polish) Analysis Plugin for ElasticSearch - GitHub - monterail/elasticsearch-analysis-morfologik: Morfologik (Polish) Analysis Plugin for ElasticSearch

The first one is from Elasticsearch team and uses Stempel library for  
handling Polish. The second one uses Morfologik analyzer, which is  
better in terms of the number of words properly handled (at least from  
my experience).

If you want to see some comparison on how those libraries work, take a  
look at [Solr 4.0 i możliwości analizy języka polskiego – Solr.pl](http://solr.pl/2012/04/02/solr-4-0-i-mozliwosci-analizy-jezyka-polskiego/)  
Its not based on Elasticsearch, but on Solr, but you will be able to  
see how those libraries compare to each other.

--  
Regards,  
Rafał Kuć  
Sematext :: [http://sematext.com/](http://sematext.com/) :: Solr - Lucene - Nutch - Elasticsearch

> Something like this, mayby not so much like finding bought when typing  
> buy, but I'm searching in our beautifull Polish language 🙂 so when I  
> will tyle "szkolenie" I would also want to find "szkoleń",  
> "szkoleniowy", "szkolenia" and so on...

> On 29 Cze, 14:21, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> 
> > Hello!
> > 
> > You mean that when you type in plural form, you also find singular and  
> > all the cases like buy, bought should be find when typing buy ? Then  
> > you also should look at analysis, because its a matter of the correct  
> > language analysis:[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/l)...  
> > .
> > 
> > --  
> > Regards,  
> > Rafał Kuć  
> > Sematext ::[http://sematext.com/::](http://sematext.com/::) Solr - Lucene - Nutch - Elasticsearch
> > 
> > AAX -\>\> AAA I meant similarity so when I will write CAT I will always
> > 
> > > fins CATS etc.  
> > > On 29 Cze, 14:07, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > 
> > > > Hello!
> > 
> > > > Use boolean query with OR to get all documents with at least one term,  
> > > > than use phrase query to boost the documents that have the words close  
> > > > to each other (look at the phrase sloop to see how you control that)  
> > > > and finally use boosting query to boost the documents that have all  
> > > > the terms in the field you are searching on. Of course all of that  
> > > > should be combined into a single query for Elasticsearch to do all the  
> > > > score calculation for you.
> > 
> > > > I don't know what you want to achieve when you say you want to have  
> > > > results of 'AAX' when querying for 'AAA'.
> > 
> > > > --  
> > > > Regards,  
> > > > Rafał Kuć  
> > > > Sematext ::[http://sematext.com/::Solr](http://sematext.com/::Solr) - Lucene - Nutch - Elasticsearch
> > 
> > > > > Heh yeah I know that it's kind of problem with answers like "you can  
> > > > > or you can or you can" and it all depends on what you need... problem  
> > > > > is that it's hard to start using this search engine because of lack of  
> > > > > documentation tuts etc  
> > > > > I would like to use it only in one case I'm searching the documents  
> > > > > using only one field always and I want to build the most standard  
> > > > > search engine for frazes that will return results from best similarity  
> > > > > to lower and so on...  
> > > > > so if I have a fraze like "AAA BBB CCC" search results will be like:  
> > > > > AAA BBB CCC  
> > > > > AAX BBB CCC  
> > > > > AAA BBB  
> > > > > AAX BBB  
> > > > > AAA  
> > > > > AAX  
> > > > > On 29 Cze, 13:28, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > > > 
> > > > > > Hello!
> > 
> > > > > > Its hard to give a general query that will work in all situations, I  
> > > > > > don't think it's even possible. You should think what fields in your  
> > > > > > index are important to you (and use boosting on those), you should  
> > > > > > think if you want phrase queries to be used to boost documents that  
> > > > > > have them present. You may also want to have some fields boost score  
> > > > > > of your documents (for example number of likes or recent date) so you  
> > > > > > may want to use custom score query. And many, many more 'You may'.
> > 
> > > > > > You should think what you want Elasticsearch to return and how and  
> > > > > > this way construct your queries.
> > 
> > > > > > --  
> > > > > > Regards,  
> > > > > > Rafa³ Kuæ  
> > > > > > Sematext ::[http://sematext.com/::Solr-](http://sematext.com/::Solr-) Lucene - Nutch - Elasticsearch
> > 
> > > > > > > anyone? I'm looking for best configuration of query\_string for  
> > > > > > > searching results?

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [July 2, 2012, 6:00am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/12 "2012-07-02T06:00:28Z")

</div>

Seems a lot of work to create such query, I thought it will be much  
easier, as they say Elasticsearch is so ready to use...

On 29 Cze, 14:36, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:

> Hello!
> 
> There are two plugins for Polish for Elasticsearch. One can be found  
> here:
> 
> [GitHub - elastic/elasticsearch-analysis-stempel: Stempel (Polish) Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-stempel)
> 
> and the second one is here:
> 
> [GitHub - monterail/elasticsearch-analysis-morfologik: Morfologik (Polish) Analysis Plugin for ElasticSearch](https://github.com/chytreg/elasticsearch-analysis-morfologik)
> 
> The first one is from Elasticsearch team and uses Stempel library for  
> handling Polish. The second one uses Morfologik analyzer, which is  
> better in terms of the number of words properly handled (at least from  
> my experience).
> 
> If you want to see some comparison on how those libraries work, take a  
> look athttp://solr.pl/2012/04/02/solr-4-0-i-mozliwosci-analizy-jezyka-polski...  
> Its not based on Elasticsearch, but on Solr, but you will be able to  
> see how those libraries compare to each other.
> 
> --  
> Regards,  
> Rafał Kuć  
> Sematext ::[http://sematext.com/::](http://sematext.com/::) Solr - Lucene - Nutch - Elasticsearch
> 
> > Something like this, mayby not so much like finding bought when typing  
> > buy, but I'm searching in our beautifull Polish language 🙂 so when I  
> > will tyle "szkolenie" I would also want to find "szkoleń",  
> > "szkoleniowy", "szkolenia" and so on...  
> > On 29 Cze, 14:21, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > 
> > > Hello!
> 
> > > You mean that when you type in plural form, you also find singular and  
> > > all the cases like buy, bought should be find when typing buy ? Then  
> > > you also should look at analysis, because its a matter of the correct  
> > > language analysis:[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/l)...  
> > > .
> 
> > > --  
> > > Regards,  
> > > Rafał Kuć  
> > > Sematext ::[http://sematext.com/::Solr](http://sematext.com/::Solr) - Lucene - Nutch - Elasticsearch
> 
> > > AAX -\>\> AAA I meant similarity so when I will write CAT I will always
> 
> > > > fins CATS etc.  
> > > > On 29 Cze, 14:07, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > > 
> > > > > Hello!
> 
> > > > > Use boolean query with OR to get all documents with at least one term,  
> > > > > than use phrase query to boost the documents that have the words close  
> > > > > to each other (look at the phrase sloop to see how you control that)  
> > > > > and finally use boosting query to boost the documents that have all  
> > > > > the terms in the field you are searching on. Of course all of that  
> > > > > should be combined into a single query for Elasticsearch to do all the  
> > > > > score calculation for you.
> 
> > > > > I don't know what you want to achieve when you say you want to have  
> > > > > results of 'AAX' when querying for 'AAA'.
> 
> > > > > --  
> > > > > Regards,  
> > > > > Rafał Kuć  
> > > > > Sematext ::[http://sematext.com/::Solr-](http://sematext.com/::Solr-) Lucene - Nutch - Elasticsearch
> 
> > > > > > Heh yeah I know that it's kind of problem with answers like "you can  
> > > > > > or you can or you can" and it all depends on what you need... problem  
> > > > > > is that it's hard to start using this search engine because of lack of  
> > > > > > documentation tuts etc  
> > > > > > I would like to use it only in one case I'm searching the documents  
> > > > > > using only one field always and I want to build the most standard  
> > > > > > search engine for frazes that will return results from best similarity  
> > > > > > to lower and so on...  
> > > > > > so if I have a fraze like "AAA BBB CCC" search results will be like:  
> > > > > > AAA BBB CCC  
> > > > > > AAX BBB CCC  
> > > > > > AAA BBB  
> > > > > > AAX BBB  
> > > > > > AAA  
> > > > > > AAX  
> > > > > > On 29 Cze, 13:28, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > > > > 
> > > > > > > Hello!
> 
> > > > > > > Its hard to give a general query that will work in all situations, I  
> > > > > > > don't think it's even possible. You should think what fields in your  
> > > > > > > index are important to you (and use boosting on those), you should  
> > > > > > > think if you want phrase queries to be used to boost documents that  
> > > > > > > have them present. You may also want to have some fields boost score  
> > > > > > > of your documents (for example number of likes or recent date) so you  
> > > > > > > may want to use custom score query. And many, many more 'You may'.
> 
> > > > > > > You should think what you want Elasticsearch to return and how and  
> > > > > > > this way construct your queries.
> 
> > > > > > > --  
> > > > > > > Regards,  
> > > > > > > Rafa³ Kuæ  
> > > > > > > Sematext ::[http://sematext.com/::Solr-Lucene](http://sematext.com/::Solr-Lucene) - Nutch - Elasticsearch
> 
> > > > > > > > anyone? I'm looking for best configuration of query\_string for  
> > > > > > > > searching results?

---

<div class="post-metadata">

### Author: ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)
#### Post date: [July 2, 2012, 7:22am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/13 "2012-07-02T07:22:16Z")

</div>

Hello!

Elasticsearch is "so ready to use", you just have to tell  
Elasticsearch what you want it to return and how 🙂

--  
Regards,  
Rafał Kuć  
Sematext :: [http://sematext.com/](http://sematext.com/) :: Solr - Lucene - Nutch - Elasticsearch

> Seems a lot of work to create such query, I thought it will be much  
> easier, as they say Elasticsearch is so ready to use...

> On 29 Cze, 14:36, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> 
> > Hello!
> > 
> > There are two plugins for Polish for Elasticsearch. One can be found  
> > here:
> > 
> > [GitHub - elastic/elasticsearch-analysis-stempel: Stempel (Polish) Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-stempel)
> > 
> > and the second one is here:
> > 
> > [GitHub - monterail/elasticsearch-analysis-morfologik: Morfologik (Polish) Analysis Plugin for ElasticSearch](https://github.com/chytreg/elasticsearch-analysis-morfologik)
> > 
> > The first one is from Elasticsearch team and uses Stempel library for  
> > handling Polish. The second one uses Morfologik analyzer, which is  
> > better in terms of the number of words properly handled (at least from  
> > my experience).
> > 
> > If you want to see some comparison on how those libraries work, take a  
> > look athttp://solr.pl/2012/04/02/solr-4-0-i-mozliwosci-analizy-jezyka-polski...  
> > Its not based on Elasticsearch, but on Solr, but you will be able to  
> > see how those libraries compare to each other.
> > 
> > --  
> > Regards,  
> > Rafał Kuć  
> > Sematext ::[http://sematext.com/::](http://sematext.com/::) Solr - Lucene - Nutch - Elasticsearch
> > 
> > > Something like this, mayby not so much like finding bought when typing  
> > > buy, but I'm searching in our beautifull Polish language 🙂 so when I  
> > > will tyle "szkolenie" I would also want to find "szkoleń",  
> > > "szkoleniowy", "szkolenia" and so on...  
> > > On 29 Cze, 14:21, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > 
> > > > Hello!
> > 
> > > > You mean that when you type in plural form, you also find singular and  
> > > > all the cases like buy, bought should be find when typing buy ? Then  
> > > > you also should look at analysis, because its a matter of the correct  
> > > > language analysis:[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/l)...  
> > > > .
> > 
> > > > --  
> > > > Regards,  
> > > > Rafał Kuć  
> > > > Sematext ::[http://sematext.com/::Solr](http://sematext.com/::Solr) - Lucene - Nutch - Elasticsearch
> > 
> > > > AAX -\>\> AAA I meant similarity so when I will write CAT I will always
> > 
> > > > > fins CATS etc.  
> > > > > On 29 Cze, 14:07, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > > > 
> > > > > > Hello!
> > 
> > > > > > Use boolean query with OR to get all documents with at least one term,  
> > > > > > than use phrase query to boost the documents that have the words close  
> > > > > > to each other (look at the phrase sloop to see how you control that)  
> > > > > > and finally use boosting query to boost the documents that have all  
> > > > > > the terms in the field you are searching on. Of course all of that  
> > > > > > should be combined into a single query for Elasticsearch to do all the  
> > > > > > score calculation for you.
> > 
> > > > > > I don't know what you want to achieve when you say you want to have  
> > > > > > results of 'AAX' when querying for 'AAA'.
> > 
> > > > > > --  
> > > > > > Regards,  
> > > > > > Rafał Kuć  
> > > > > > Sematext ::[http://sematext.com/::Solr-](http://sematext.com/::Solr-) Lucene - Nutch - Elasticsearch
> > 
> > > > > > > Heh yeah I know that it's kind of problem with answers like "you can  
> > > > > > > or you can or you can" and it all depends on what you need... problem  
> > > > > > > is that it's hard to start using this search engine because of lack of  
> > > > > > > documentation tuts etc  
> > > > > > > I would like to use it only in one case I'm searching the documents  
> > > > > > > using only one field always and I want to build the most standard  
> > > > > > > search engine for frazes that will return results from best similarity  
> > > > > > > to lower and so on...  
> > > > > > > so if I have a fraze like "AAA BBB CCC" search results will be like:  
> > > > > > > AAA BBB CCC  
> > > > > > > AAX BBB CCC  
> > > > > > > AAA BBB  
> > > > > > > AAX BBB  
> > > > > > > AAA  
> > > > > > > AAX  
> > > > > > > On 29 Cze, 13:28, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > > > > > 
> > > > > > > > Hello!
> > 
> > > > > > > > Its hard to give a general query that will work in all situations, I  
> > > > > > > > don't think it's even possible. You should think what fields in your  
> > > > > > > > index are important to you (and use boosting on those), you should  
> > > > > > > > think if you want phrase queries to be used to boost documents that  
> > > > > > > > have them present. You may also want to have some fields boost score  
> > > > > > > > of your documents (for example number of likes or recent date) so you  
> > > > > > > > may want to use custom score query. And many, many more 'You may'.
> > 
> > > > > > > > You should think what you want Elasticsearch to return and how and  
> > > > > > > > this way construct your queries.
> > 
> > > > > > > > --  
> > > > > > > > Regards,  
> > > > > > > > Rafa³ Kuæ  
> > > > > > > > Sematext ::[http://sematext.com/::Solr-Lucene](http://sematext.com/::Solr-Lucene) - Nutch - Elasticsearch
> > 
> > > > > > > > > anyone? I'm looking for best configuration of query\_string for  
> > > > > > > > > searching results?

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [July 2, 2012, 10:25am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/14 "2012-07-02T10:25:29Z")

</div>

Yes, but as I think this kind of searching I would like to implement into  
my app is the most popular one than anyone could ever want to use and there  
is no predefined query for that in ES, for people that start they adventure  
with ES it is hard to build such comlicated query as the one I need to  
build following your description, couldn't that be done by elastic  
itself?...

W dniu poniedziałek, 2 lipca 2012 09:22:16 UTC+2 użytkownik Rafał Kuć  
napisał:

> Hello!
> 
> Elasticsearch is "so ready to use", you just have to tell  
> Elasticsearch what you want it to return and how 🙂
> 
> --  
> Regards,  
> Rafał Kuć  
> Sematext :: [http://sematext.com/](http://sematext.com/) :: Solr - Lucene - Nutch -  
> Elasticsearch
> 
> > Seems a lot of work to create such query, I thought it will be much  
> > easier, as they say Elasticsearch is so ready to use...
> 
> > On 29 Cze, 14:36, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > 
> > > Hello!
> > > 
> > > There are two plugins for Polish for Elasticsearch. One can be found  
> > > here:
> > > 
> > > [GitHub - elastic/elasticsearch-analysis-stempel: Stempel (Polish) Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-stempel)
> > > 
> > > and the second one is here:
> > > 
> > > [GitHub - monterail/elasticsearch-analysis-morfologik: Morfologik (Polish) Analysis Plugin for ElasticSearch](https://github.com/chytreg/elasticsearch-analysis-morfologik)
> > > 
> > > The first one is from Elasticsearch team and uses Stempel library for  
> > > handling Polish. The second one uses Morfologik analyzer, which is  
> > > better in terms of the number of words properly handled (at least from  
> > > my experience).
> > > 
> > > If you want to see some comparison on how those libraries work, take a  
> > > look athttp://  
> > > solr.pl/2012/04/02/solr-4-0-i-mozliwosci-analizy-jezyka-polski...  
> > > Its not based on Elasticsearch, but on Solr, but you will be able to  
> > > see how those libraries compare to each other.
> > > 
> > > --  
> > > Regards,  
> > > Rafał Kuć  
> > > Sematext ::[http://sematext.com/::](http://sematext.com/::) Solr - Lucene - Nutch -  
> > > Elasticsearch
> > > 
> > > > Something like this, mayby not so much like finding bought when  
> > > > typing  
> > > > buy, but I'm searching in our beautifull Polish language 🙂 so when I  
> > > > will tyle "szkolenie" I would also want to find "szkoleń",  
> > > > "szkoleniowy", "szkolenia" and so on...  
> > > > On 29 Cze, 14:21, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > > 
> > > > > Hello!
> > > 
> > > > > You mean that when you type in plural form, you also find singular  
> > > > > and  
> > > > > all the cases like buy, bought should be find when typing buy ? Then  
> > > > > you also should look at analysis, because its a matter of the  
> > > > > correct  
> > > > > language analysis:  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/l)...  
> > > > > .
> > > 
> > > > > --  
> > > > > Regards,  
> > > > > Rafał Kuć  
> > > > > Sematext ::[http://sematext.com/::Solr](http://sematext.com/::Solr) - Lucene - Nutch -  
> > > > > Elasticsearch
> > > 
> > > > > AAX -\>\> AAA I meant similarity so when I will write CAT I will  
> > > > > always
> > > 
> > > > > > fins CATS etc.  
> > > > > > On 29 Cze, 14:07, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > > > > 
> > > > > > > Hello!
> > > 
> > > > > > > Use boolean query with OR to get all documents with at least one  
> > > > > > > term,  
> > > > > > > than use phrase query to boost the documents that have the words  
> > > > > > > close  
> > > > > > > to each other (look at the phrase sloop to see how you control  
> > > > > > > that)  
> > > > > > > and finally use boosting query to boost the documents that have  
> > > > > > > all  
> > > > > > > the terms in the field you are searching on. Of course all of  
> > > > > > > that  
> > > > > > > should be combined into a single query for Elasticsearch to do  
> > > > > > > all the  
> > > > > > > score calculation for you.
> > > 
> > > > > > > I don't know what you want to achieve when you say you want to  
> > > > > > > have  
> > > > > > > results of 'AAX' when querying for 'AAA'.
> > > 
> > > > > > > --  
> > > > > > > Regards,  
> > > > > > > Rafał Kuć  
> > > > > > > Sematext ::[http://sematext.com/::Solr-](http://sematext.com/::Solr-) Lucene - Nutch -  
> > > > > > > Elasticsearch
> > > 
> > > > > > > > Heh yeah I know that it's kind of problem with answers like  
> > > > > > > > "you can  
> > > > > > > > or you can or you can" and it all depends on what you need...  
> > > > > > > > problem  
> > > > > > > > is that it's hard to start using this search engine because of  
> > > > > > > > lack of  
> > > > > > > > documentation tuts etc  
> > > > > > > > I would like to use it only in one case I'm searching the  
> > > > > > > > documents  
> > > > > > > > using only one field always and I want to build the most  
> > > > > > > > standard  
> > > > > > > > search engine for frazes that will return results from best  
> > > > > > > > similarity  
> > > > > > > > to lower and so on...  
> > > > > > > > so if I have a fraze like "AAA BBB CCC" search results will be  
> > > > > > > > like:  
> > > > > > > > AAA BBB CCC  
> > > > > > > > AAX BBB CCC  
> > > > > > > > AAA BBB  
> > > > > > > > AAX BBB  
> > > > > > > > AAA  
> > > > > > > > AAX  
> > > > > > > > On 29 Cze, 13:28, Rafał Kuć [r....@solr.pl](mailto:r....@solr.pl) wrote:
> > > > > > > > 
> > > > > > > > > Hello!
> > > 
> > > > > > > > > Its hard to give a general query that will work in all  
> > > > > > > > > situations, I  
> > > > > > > > > don't think it's even possible. You should think what fields  
> > > > > > > > > in your  
> > > > > > > > > index are important to you (and use boosting on those), you  
> > > > > > > > > should  
> > > > > > > > > think if you want phrase queries to be used to boost documents  
> > > > > > > > > that  
> > > > > > > > > have them present. You may also want to have some fields boost  
> > > > > > > > > score  
> > > > > > > > > of your documents (for example number of likes or recent date)  
> > > > > > > > > so you  
> > > > > > > > > may want to use custom score query. And many, many more 'You  
> > > > > > > > > may'.
> > > 
> > > > > > > > > You should think what you want Elasticsearch to return and how  
> > > > > > > > > and  
> > > > > > > > > this way construct your queries.
> > > 
> > > > > > > > > --  
> > > > > > > > > Regards,  
> > > > > > > > > Rafa³ Kuæ  
> > > > > > > > > Sematext ::[http://sematext.com/::Solr-Lucene](http://sematext.com/::Solr-Lucene) - Nutch -  
> > > > > > > > > Elasticsearch
> > > 
> > > > > > > > > > anyone? I'm looking for best configuration of query\_string  
> > > > > > > > > > for  
> > > > > > > > > > searching results?

---

<div class="post-metadata">

### Author: ![shadow](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@shadow](https://discuss.elastic.co/u/shadow)
#### Post date: [July 2, 2012, 4:20pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/15 "2012-07-02T16:20:07Z")

</div>

Hello Rafa

I read your comments about adding boost to fields in a document during  
indexing and post indexing. I'm a beginner in Elasticsearch and cant seem  
to get it working. Can you give me an example of how exactly to use boost.  
I really need it for what I'm trying to do. A quick help will be greatly  
appreciated. thanks!

On Friday, June 29, 2012 4:28:28 AM UTC-7, Rafał Kuć wrote:

> Hello!
> 
> Its hard to give a general query that will work in all situations, I  
> don't think it's even possible. You should think what fields in your  
> index are important to you (and use boosting on those), you should  
> think if you want phrase queries to be used to boost documents that  
> have them present. You may also want to have some fields boost score  
> of your documents (for example number of likes or recent date) so you  
> may want to use custom score query. And many, many more 'You may'.
> 
> You should think what you want Elasticsearch to return and how and  
> this way construct your queries.
> 
> --  
> Regards,  
> Rafał Kuć  
> Sematext :: [http://sematext.com/](http://sematext.com/) :: Solr - Lucene - Nutch -  
> Elasticsearch
> 
> > anyone? I'm looking for best configuration of query\_string for  
> > searching results?

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [July 3, 2012, 10:26am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/16 "2012-07-03T10:26:50Z")

</div>

That would be so nice If you could show an example of such query with many  
nested options boosts etc.

W dniu poniedziałek, 2 lipca 2012 18:20:07 UTC+2 użytkownik Shadow napisał:

> Hello Rafa
> 
> I read your comments about adding boost to fields in a document during  
> indexing and post indexing. I'm a beginner in Elasticsearch and cant seem  
> to get it working. Can you give me an example of how exactly to use boost.  
> I really need it for what I'm trying to do. A quick help will be greatly  
> appreciated. thanks!
> 
> On Friday, June 29, 2012 4:28:28 AM UTC-7, Rafał Kuć wrote:
> 
> > Hello!
> > 
> > Its hard to give a general query that will work in all situations, I  
> > don't think it's even possible. You should think what fields in your  
> > index are important to you (and use boosting on those), you should  
> > think if you want phrase queries to be used to boost documents that  
> > have them present. You may also want to have some fields boost score  
> > of your documents (for example number of likes or recent date) so you  
> > may want to use custom score query. And many, many more 'You may'.
> > 
> > You should think what you want Elasticsearch to return and how and  
> > this way construct your queries.
> > 
> > --  
> > Regards,  
> > Rafał Kuć  
> > Sematext :: [http://sematext.com/](http://sematext.com/) :: Solr - Lucene - Nutch -  
> > Elasticsearch
> > 
> > > anyone? I'm looking for best configuration of query\_string for  
> > > searching results?

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [July 4, 2012, 11:12am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/17 "2012-07-04T11:12:15Z")

</div>

could anyone provide some exaples that are more complex than the ones on  
elasticsearch web page or some sources where they can be found ???

---

<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: [July 4, 2012, 11:18am UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/18 "2012-07-04T11:18:56Z")

</div>

On Wed, 2012-07-04 at 04:12 -0700, Marcin Oleszkiewicz wrote:

> could anyone provide some exaples that are more complex than the ones  
> on elasticsearch web page or some sources where they can be found ???

Marcin, why don't you show us what you've tried, what you're trying to  
do, and what doesn't work for you.

That way it'll be much easier to give you useful advice

Have a look at [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)

clint

---

<div class="post-metadata">

### Author: ![Marcin\_Oleszkiewicz](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcin\_Oleszkiewicz](https://discuss.elastic.co/u/Marcin_Oleszkiewicz)
#### Post date: [July 5, 2012, 12:22pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/19 "2012-07-05T12:22:06Z")

</div>

at the moment I know (thanks to Rafał) how should I build such query

1. BOOLEAN query with OR that will find all docs with at least one term
2. PHRASE\_QUERY to boost documents with words close to each other (using  
sloop)
3. BOOSTING QUERY to boost that have all terms in the field
4. use some language plugin

how to combine it to a query, it's kinda hard fo a newbie

---

<div class="post-metadata">

### Author: ![Shaun\_Etherton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaun_etherton/32/2540_2.png) [@Shaun\_Etherton](https://discuss.elastic.co/u/Shaun_Etherton)
#### Post date: [July 5, 2012, 2:31pm UTC](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194/20 "2012-07-05T14:31:06Z")

</div>

Hi Marcin

You're not alone; i've found the query DSL quite difficult to understand.

This is what i have for my search so far. It's basically a wildcard text search which is then filtered to restrict access based on some  
of the document properties.

Perhaps this is even more basic than you're looking for. I'm only just starting out with ES and have never used Lucene before.  
I imagine what i have done would be considered absolutely terrible by those "in the know".

[https://gist.github.com/3053914](https://gist.github.com/3053914)

I'd be very grateful if someone who has a good understanding of the ES query DSL could take a look at that gist and provide some feedback about the way i've done it and possibly show me how to improve it and/or some alternative implementations.

A tutorial about the DSL structure would be good (for totally new users) but i have not seen anything very helpful to me yet.  
It's just been lots of head-scratching and trial-&-error so far. 🙂

cheers

- shaun

--  
shaun etherton  
Sent with Sparrow ([http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig))

On Thursday, 5 July 2012 at 9:52 PM, Marcin Oleszkiewicz wrote:

> at the moment I know (thanks to Rafał) how should I build such query
> 
> 1. BOOLEAN query with OR that will find all docs with at least one term
> 2. PHRASE\_QUERY to boost documents with words close to each other (using sloop)
> 3. BOOSTING QUERY to boost that have all terms in the field
> 4. use some language plugin
> 
> how to combine it to a query, it's kinda hard fo a newbie

[Next page](https://discuss.elastic.co/t/which-query-is-the-best-for-standard-searching/8194.md?page=2)
