# Ranking result using key-words

**URL:** <https://discuss.elastic.co/t/ranking-result-using-key-words/17054>\
**Category:** Elasticsearch\
**Created:** [April 16, 2014, 8:57pm UTC](https://discuss.elastic.co/t/ranking-result-using-key-words/17054 "2014-04-16T20:57:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Willian\_Gigliotti](https://avatars.discourse-cdn.com/v4/letter/w/96bed5/32.png) [@Willian\_Gigliotti](https://discuss.elastic.co/u/Willian_Gigliotti)\
**Post date:** [April 16, 2014, 8:57pm UTC](https://discuss.elastic.co/t/ranking-result-using-key-words/17054/1 "2014-04-16T20:57:41Z")

</div>

```
Hi,

I have read only access to an ElasticSearch 0.90 version with a huge 

```

collection of Brazilian Official Gazette pages.

```
We are using that to search for people names like "Gisele Bundchen". 

```

Our search is something like this:

- {\*
- 

```
      "from": 0,*

```

- 

```
      "size": 2,*

```

- 

```
      "query": {*

```

- 

```
         "query_string": {*

```

- 

```
            "query": "\"Gisele Bundchen\""*

```

- 

```
         }*

```

- 

```
      }*

```

- }\*

```
And I found 30 pages, for instance. But most of them are useless to us. 

```

I would love to rank the results based on some key-words, let's say "legal  
settlement", "jail" and "lawsuit". So I tried the following search:

- { "from": 0, "size": 2, "query":  
{ "query\_string": { "query": ""Gisele  
Bundchen"^5 "legal settlement"^1 jail^2 lawsuit^2"  
} } }\*

```
I got a ranked result, but now I have five million pages instead of 30 

```

from the first result.

```
I could use AND instead of OR, but I don't want to risk missing any 

```

relevant results.

```
Would you have any ideas on how to fix that?

Thanks a lot!

```

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/cc4e9d6d-9bdb-48d2-b6f0-29358b17f642%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cc4e9d6d-9bdb-48d2-b6f0-29358b17f642%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ankush\_Jhalani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankush_jhalani/32/875_2.png) [@Ankush\_Jhalani](https://discuss.elastic.co/u/Ankush_Jhalani)\
**Post date:** [April 16, 2014, 9:01pm UTC](https://discuss.elastic.co/t/ranking-result-using-key-words/17054/2 "2014-04-16T21:01:28Z")

</div>

You could do something like  
_"+"Gisele Bundchen"^5 "legal settlement"^1 jail^2 lawsuit^2"_ which  
would mean results must have Gisele Bundchen while others are optional and  
help in ranking results.

On Wednesday, April 16, 2014 4:57:41 PM UTC-4, Willian Gigliotti wrote:

> ```
> Hi,
> 
> I have read only access to an ElasticSearch 0.90 version with a huge 
> 
> ```
> 
> collection of Brazilian Official Gazette pages.
> 
> ```
> We are using that to search for people names like "Gisele Bundchen". 
> 
> ```
> 
> Our search is something like this:
> 
> - {\*
> - 
> 
> ```
> "from": 0,*
> 
> ```
> 
> - 
> 
> ```
> "size": 2,*
> 
> ```
> 
> - 
> 
> ```
> "query": {*
> 
> ```
> 
> - 
> 
> ```
> "query_string": {*
> 
> ```
> 
> - 
> 
> ```
> "query": "\"Gisele Bundchen\""*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - }\*
> 
> ```
> And I found 30 pages, for instance. But most of them are useless to 
> 
> ```
> 
> us. I would love to rank the results based on some key-words, let's say  
> "legal settlement", "jail" and "lawsuit". So I tried the following search:
> 
> - { "from": 0, "size": 2, "query":  
> { "query\_string": { "query": ""Gisele  
> Bundchen"^5 "legal settlement"^1 jail^2 lawsuit^2"  
> } } }\*
> 
> ```
> I got a ranked result, but now I have five million pages instead of 30 
> 
> ```
> 
> from the first result.
> 
> ```
> I could use AND instead of OR, but I don't want to risk missing any 
> 
> ```
> 
> relevant results.
> 
> ```
> Would you have any ideas on how to fix that?
> 
> Thanks a lot!
> 
> ```

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/72a0949c-61a4-4060-9b61-1d716c312846%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/72a0949c-61a4-4060-9b61-1d716c312846%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Willian\_Gigliotti](https://avatars.discourse-cdn.com/v4/letter/w/96bed5/32.png) [@Willian\_Gigliotti](https://discuss.elastic.co/u/Willian_Gigliotti)\
**Post date:** [April 17, 2014, 11:18am UTC](https://discuss.elastic.co/t/ranking-result-using-key-words/17054/3 "2014-04-17T11:18:33Z")

</div>

Thanks Ankush, that worked!

Em quarta-feira, 16 de abril de 2014 18h01min28s UTC-3, Ankush Jhalani  
escreveu:

> You could do something like  
> _"+"Gisele Bundchen"^5 "legal settlement"^1 jail^2 lawsuit^2"_ which  
> would mean results must have Gisele Bundchen while others are optional and  
> help in ranking results.
> 
> On Wednesday, April 16, 2014 4:57:41 PM UTC-4, Willian Gigliotti wrote:
> 
> > ```
> > Hi,
> > 
> > I have read only access to an ElasticSearch 0.90 version with a huge 
> > 
> > ```
> > 
> > collection of Brazilian Official Gazette pages.
> > 
> > ```
> > We are using that to search for people names like "Gisele Bundchen". 
> > 
> > ```
> > 
> > Our search is something like this:
> > 
> > - {\*
> > - 
> > 
> > ```
> > "from": 0,*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "size": 2,*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "query": {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "query_string": {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "query": "\"Gisele Bundchen\""*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - }\*
> > 
> > ```
> > And I found 30 pages, for instance. But most of them are useless to 
> > 
> > ```
> > 
> > us. I would love to rank the results based on some key-words, let's say  
> > "legal settlement", "jail" and "lawsuit". So I tried the following search:
> > 
> > - { "from": 0, "size": 2, "query":  
> > { "query\_string": { "query": ""Gisele  
> > Bundchen"^5 "legal settlement"^1 jail^2 lawsuit^2"  
> > } } }\*
> > 
> > ```
> > I got a ranked result, but now I have five million pages instead of 
> > 
> > ```
> > 
> > 30 from the first result.
> > 
> > ```
> > I could use AND instead of OR, but I don't want to risk missing any 
> > 
> > ```
> > 
> > relevant results.
> > 
> > ```
> > Would you have any ideas on how to fix that?
> > 
> > Thanks a lot!
> > 
> > ```

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9805dcfd-3c58-4cf5-b9c4-9588dc437847%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9805dcfd-3c58-4cf5-b9c4-9588dc437847%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:35am UTC](https://discuss.elastic.co/t/ranking-result-using-key-words/17054/4 "2017-07-06T01:35:18Z")

</div>


