# Query help

**URL:** https://discuss.elastic.co/t/query-help/3070
**Category:** Elasticsearch
**Created:** [July 6, 2010, 7:02pm UTC](https://discuss.elastic.co/t/query-help/3070 "2010-07-06T19:02:43Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![sallyjones](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sallyjones](https://discuss.elastic.co/u/sallyjones)
#### Post date: [July 6, 2010, 7:02pm UTC](https://discuss.elastic.co/t/query-help/3070/1 "2010-07-06T19:02:43Z")

</div>

Hi

I am struggling with what I thought should be a simple query. Here is  
a data example:

{paragraphs=[  
{important=true, wordCount=122, text="blah blah blah..."},  
{important=false, wordCount=31, text="some more blah blah blah"} ],  
author="sally",  
postDate=2010-07-06}

I am trying to find documents that have a "paragraphs.text" that match  
passed in keywords (easy), but I want to score the "value" of the  
document that matched based on paragraph's associated "wordCount" and  
"important" properties. More specifically, I want to favor the hits  
that are on paragraphs that are important=true and have a low word  
count.

I can see the SQL and code to do it in my head, but after  
experimenting and digging through the docs, I am stumped on how to do  
it with ES. Any help is greatly appreciated!  
Sally

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [July 6, 2010, 7:09pm UTC](https://discuss.elastic.co/t/query-help/3070/2 "2010-07-06T19:09:32Z")

</div>

I think that what you are looking for is this feature:  
[Issues · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/closed#issue/220) which  
will be part of 0.9.

-shay.banon

On Tue, Jul 6, 2010 at 10:02 PM, sallyjones [sallybop291@yahoo.com](mailto:sallybop291@yahoo.com) wrote:

> Hi
> 
> I am struggling with what I thought should be a simple query. Here is  
> a data example:
> 
> {paragraphs=[  
> {important=true, wordCount=122, text="blah blah blah..."},  
> {important=false, wordCount=31, text="some more blah blah blah"} ],  
> author="sally",  
> postDate=2010-07-06}
> 
> I am trying to find documents that have a "paragraphs.text" that match  
> passed in keywords (easy), but I want to score the "value" of the  
> document that matched based on paragraph's associated "wordCount" and  
> "important" properties. More specifically, I want to favor the hits  
> that are on paragraphs that are important=true and have a low word  
> count.
> 
> I can see the SQL and code to do it in my head, but after  
> experimenting and digging through the docs, I am stumped on how to do  
> it with ES. Any help is greatly appreciated!  
> Sally

---

<div class="post-metadata">

### Author: ![sallyjones](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sallyjones](https://discuss.elastic.co/u/sallyjones)
#### Post date: [July 6, 2010, 8:01pm UTC](https://discuss.elastic.co/t/query-help/3070/3 "2010-07-06T20:01:56Z")

</div>

Thanks for the quick response, and thats a very nice feature. Does  
the latest version of the source include the 0.9 features or do I need  
to wait for an official 0.9 release?

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [July 6, 2010, 8:11pm UTC](https://discuss.elastic.co/t/query-help/3070/4 "2010-07-06T20:11:23Z")

</div>

Its already in master, so if you want to try it, you can build from source  
and give it a go.

-shay.banon

On Tue, Jul 6, 2010 at 11:01 PM, sallyjones [sallybop291@yahoo.com](mailto:sallybop291@yahoo.com) wrote:

> Thanks for the quick response, and thats a very nice feature. Does  
> the latest version of the source include the 0.9 features or do I need  
> to wait for an official 0.9 release?

---

<div class="post-metadata">

### Author: ![sallyjones](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sallyjones](https://discuss.elastic.co/u/sallyjones)
#### Post date: [July 6, 2010, 8:14pm UTC](https://discuss.elastic.co/t/query-help/3070/5 "2010-07-06T20:14:13Z")

</div>

Thanks, I'll let you know how it goes.

---

<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:22am UTC](https://discuss.elastic.co/t/query-help/3070/6 "2017-07-06T04:22:38Z")

</div>


