# Cannot find though the whole document

**URL:** <https://discuss.elastic.co/t/cannot-find-though-the-whole-document/5589>\
**Category:** Elasticsearch\
**Created:** [October 13, 2011, 2:09pm UTC](https://discuss.elastic.co/t/cannot-find-though-the-whole-document/5589 "2011-10-13T14:09:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![1114](https://avatars.discourse-cdn.com/v4/letter/1/77aa72/32.png) [@1114](https://discuss.elastic.co/u/1114)\
**Post date:** [October 13, 2011, 2:09pm UTC](https://discuss.elastic.co/t/cannot-find-though-the-whole-document/5589/1 "2011-10-13T14:09:43Z")

</div>

Sorry if this is RTFM, but i spent several hours tried to compose  
search query.

I have a clothes index with shirts, shoes and so on. All items have  
some attributes such as collor, size, brand. In my application i have  
search string like "red nike t-shirt" or just "red shirt". How can i  
make elasticsearch to find relevant items?

Thanks!

---

<div class="post-metadata">

**Author:** ![Gabriel\_Farrell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_farrell/32/3337_2.png) [@Gabriel\_Farrell](https://discuss.elastic.co/u/Gabriel_Farrell)\
**Post date:** [October 13, 2011, 8:45pm UTC](https://discuss.elastic.co/t/cannot-find-though-the-whole-document/5589/2 "2011-10-13T20:45:52Z")

</div>

You'll have to be more specific. Can you show us an example document?  
Are you using explicit mappings? Are you using query\_string in the  
query DSL? In general, if you're adjusting relevancy, you'll want to

1. adjust index-time boost with a mapping  
([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/boost-field.html))  
and/or
2. adjust query-time boost with a multi-field query\_string  
([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))

On Thu, Oct 13, 2011 at 10:09 AM, Андрей [andrey.smolev@gmail.com](mailto:andrey.smolev@gmail.com) wrote:

> Sorry if this is RTFM, but i spent several hours tried to compose  
> search query.
> 
> I have a clothes index with shirts, shoes and so on. All items have  
> some attributes such as collor, size, brand. In my application i have  
> search string like "red nike t-shirt" or just "red shirt". How can i  
> make elasticsearch to find relevant items?
> 
> Thanks!

---

<div class="post-metadata">

**Author:** ![1114](https://avatars.discourse-cdn.com/v4/letter/1/77aa72/32.png) [@1114](https://discuss.elastic.co/u/1114)\
**Post date:** [October 14, 2011, 2:59pm UTC](https://discuss.elastic.co/t/cannot-find-though-the-whole-document/5589/3 "2011-10-14T14:59:10Z")

</div>

Resolved it this way  
source={"query":{"query\_string":{"default\_field":"\_all",  
"default\_operator":"AND","query":"white~0.7 shoes~0.7  
adidas~0.7"}},"fields":["colorList","price","picture","name","vendor","shop","sizeList","colour\_image","elegance","offer  
id","description"],"size":100,"sort":{"\_score":{"order":"desc"}},"filter":{"and":[{"term":{"available":1}}]}}

But I do not like "~0.7" in the querry, now I parse input string and replace  
spaces with "~0.7 " but may be there is any better solution? tried "  
fuzzy\_min\_sim":0.7 but it doesn't work like ~0.7...

On Fri, Oct 14, 2011 at 12:45 AM, Gabriel Farrell [gsf747@gmail.com](mailto:gsf747@gmail.com) wrote:

> You'll have to be more specific. Can you show us an example document?  
> Are you using explicit mappings? Are you using query\_string in the  
> query DSL? In general, if you're adjusting relevancy, you'll want to
> 
> 1. adjust index-time boost with a mapping  
> ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/boost-field.html))  
> and/or
> 2. adjust query-time boost with a multi-field query\_string  
> (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html)  
> )
> 
> On Thu, Oct 13, 2011 at 10:09 AM, Андрей [andrey.smolev@gmail.com](mailto:andrey.smolev@gmail.com) wrote:
> 
> > Sorry if this is RTFM, but i spent several hours tried to compose  
> > search query.
> > 
> > I have a clothes index with shirts, shoes and so on. All items have  
> > some attributes such as collor, size, brand. In my application i have  
> > search string like "red nike t-shirt" or just "red shirt". How can i  
> > make elasticsearch to find relevant items?
> > 
> > Thanks!

---

<div class="post-metadata">

**Author:** ![Gabriel\_Farrell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_farrell/32/3337_2.png) [@Gabriel\_Farrell](https://discuss.elastic.co/u/Gabriel_Farrell)\
**Post date:** [October 14, 2011, 9:44pm UTC](https://discuss.elastic.co/t/cannot-find-though-the-whole-document/5589/4 "2011-10-14T21:44:28Z")

</div>

fuzzy\_min\_sim only applies to terms with a tilde, but no required  
similarity set. So you could change your query to "white~ shoes~  
adidas~" and set fuzzy\_min\_sim to 0.7 for the same result.

Since you're already parsing the input, however, you might consider  
putting all the terms in a fuzzy query (boosted at 0.8 or so) and  
running it alongside the regular query.

On Fri, Oct 14, 2011 at 10:59 AM, Андрей Смолев [andrey.smolev@gmail.com](mailto:andrey.smolev@gmail.com) wrote:

> Resolved it this way  
> source={"query":{"query\_string":{"default\_field":"\_all",  
> "default\_operator":"AND","query":"white~0.7 shoes~0.7  
> adidas~0.7"}},"fields":["colorList","price","picture","name","vendor","shop","sizeList","colour\_image","elegance","offer  
> id","description"],"size":100,"sort":{"\_score":{"order":"desc"}},"filter":{"and":[{"term":{"available":1}}]}}
> 
> But I do not like "~0.7" in the querry, now I parse input string and replace  
> spaces with "~0.7 " but may be there is any better solution? tried  
> "fuzzy\_min\_sim":0.7 but it doesn't work like ~0.7...
> 
> On Fri, Oct 14, 2011 at 12:45 AM, Gabriel Farrell [gsf747@gmail.com](mailto:gsf747@gmail.com) wrote:
> 
> > You'll have to be more specific. Can you show us an example document?  
> > Are you using explicit mappings? Are you using query\_string in the  
> > query DSL? In general, if you're adjusting relevancy, you'll want to
> > 
> > 1. adjust index-time boost with a mapping  
> > ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/boost-field.html))  
> > and/or
> > 2. adjust query-time boost with a multi-field query\_string
> > 
> > ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))
> > 
> > On Thu, Oct 13, 2011 at 10:09 AM, Андрей [andrey.smolev@gmail.com](mailto:andrey.smolev@gmail.com) wrote:
> > 
> > > Sorry if this is RTFM, but i spent several hours tried to compose  
> > > search query.
> > > 
> > > I have a clothes index with shirts, shoes and so on. All items have  
> > > some attributes such as collor, size, brand. In my application i have  
> > > search string like "red nike t-shirt" or just "red shirt". How can i  
> > > make elasticsearch to find relevant items?
> > > 
> > > Thanks!

---

<div class="post-metadata">

**Author:** ![1114](https://avatars.discourse-cdn.com/v4/letter/1/77aa72/32.png) [@1114](https://discuss.elastic.co/u/1114)\
**Post date:** [October 18, 2011, 7:08pm UTC](https://discuss.elastic.co/t/cannot-find-though-the-whole-document/5589/5 "2011-10-18T19:08:53Z")

</div>

Thank you, it works for me!  
On Oct 15, 2011 1:44 AM, "Gabriel Farrell" [gsf747@gmail.com](mailto:gsf747@gmail.com) wrote:

---

<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, 3:51am UTC](https://discuss.elastic.co/t/cannot-find-though-the-whole-document/5589/6 "2017-07-06T03:51:29Z")

</div>

Closed on July 6, 2017, 3:51am UTC


