# Having trouble querying / boosting, learning curve I suspect...? Please help!? :)

**URL:** <https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954>\
**Category:** Elasticsearch\
**Created:** [March 8, 2012, 10:00pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954 "2012-03-08T22:00:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joshua\_Rountree](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rountree/32/2959_2.png) [@Joshua\_Rountree](https://discuss.elastic.co/u/Joshua_Rountree)\
**Post date:** [March 8, 2012, 10:00pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/1 "2012-03-08T22:00:12Z")

</div>

I'm new to elastic search...  
First off, I love this so far (I think)....

The documentation confuses me.

So I've indexed some geonames data from a mysql table.  
It has a field that contains things like:  
"Miami FL Florida USA US United States"

Whatever...

So, for the most part with MOST CITIES it returns perfectly accurate  
results.

But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL, I'm  
getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the results.

So I thought to myself... I need to boost based on POPULATION somehow...

Is this possible?

I tried looking into "boosting" "boost\_field" etc and simply do not  
understand how to approach this.

Combining with the search term...  
Ideally, the higher the population - the higher the relevance...?

Any clues?

---

<div class="post-metadata">

**Author:** ![Joshua\_Rountree](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rountree/32/2959_2.png) [@Joshua\_Rountree](https://discuss.elastic.co/u/Joshua_Rountree)\
**Post date:** [March 8, 2012, 10:07pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/2 "2012-03-08T22:07:14Z")

</div>

Also, I'd love it to work similar to this...  
[http://ws.geonames.org/searchJSON?q=Miami%20FL&maxRows=10&callback=getLocation&noCacheIE=1331244227337](http://ws.geonames.org/searchJSON?q=Miami%20FL&maxRows=10&callback=getLocation&noCacheIE=1331244227337)

Except mine is just doing cities, only difference.

This returns:  
1.) Miami  
2.) Miami Beach

That is exactly how mine should return... if anyone could possibly help!  
I'm pretty desperate now... 😛

On Thursday, March 8, 2012 5:00:12 PM UTC-5, Joshua Rountree wrote:

> I'm new to Elasticsearch...  
> First off, I love this so far (I think)....
> 
> The documentation confuses me.
> 
> So I've indexed some geonames data from a mysql table.  
> It has a field that contains things like:  
> "Miami FL Florida USA US United States"
> 
> Whatever...
> 
> So, for the most part with MOST CITIES it returns perfectly accurate  
> results.
> 
> But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL,  
> I'm getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> results.
> 
> So I thought to myself... I need to boost based on POPULATION somehow...
> 
> Is this possible?
> 
> I tried looking into "boosting" "boost\_field" etc and simply do not  
> understand how to approach this.
> 
> Combining with the search term...  
> Ideally, the higher the population - the higher the relevance...?
> 
> Any clues?

On Thursday, March 8, 2012 5:00:12 PM UTC-5, Joshua Rountree wrote:

> I'm new to Elasticsearch...  
> First off, I love this so far (I think)....
> 
> The documentation confuses me.
> 
> So I've indexed some geonames data from a mysql table.  
> It has a field that contains things like:  
> "Miami FL Florida USA US United States"
> 
> Whatever...
> 
> So, for the most part with MOST CITIES it returns perfectly accurate  
> results.
> 
> But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL,  
> I'm getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> results.
> 
> So I thought to myself... I need to boost based on POPULATION somehow...
> 
> Is this possible?
> 
> I tried looking into "boosting" "boost\_field" etc and simply do not  
> understand how to approach this.
> 
> Combining with the search term...  
> Ideally, the higher the population - the higher the relevance...?
> 
> Any clues?

---

<div class="post-metadata">

**Author:** ![Radu\_Gheorghe1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe1/32/2688_2.png) [@Radu\_Gheorghe1](https://discuss.elastic.co/u/Radu_Gheorghe1)\
**Post date:** [March 9, 2012, 7:16am UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/3 "2012-03-09T07:16:19Z")

</div>

Hi Joshua,

The text query should do the trick:  
curl -XGET [http://localhost:9200/\_search?pretty=true](http://localhost:9200/_search?pretty=true) -d '{  
"query" : {  
"text" : {  
"message" : "Miami FL"  
}  
}  
}'

First results would be those that contain both Miami and FL.

You can also try a bool query:

> **[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.

Then you can put some queries as "must" (need to match to return a  
hit) and some as "should" (hit is still returned even if the document  
doesn't match, but I assume it has a higher score).

Hope this helps. I'm also in a steep ES learning curve 🙂

Best regards,  
Radu

On Mar 9, 12:00 am, Joshua Rountree [jos...@remote-app.com](mailto:jos...@remote-app.com) wrote:

> I'm new to Elasticsearch...  
> First off, I love this so far (I think)....
> 
> The documentation confuses me.
> 
> So I've indexed some geonames data from a mysql table.  
> It has a field that contains things like:  
> "Miami FL Florida USA US United States"
> 
> Whatever...
> 
> So, for the most part with MOST CITIES it returns perfectly accurate  
> results.
> 
> But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL, I'm  
> getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the results.
> 
> So I thought to myself... I need to boost based on POPULATION somehow...
> 
> Is this possible?
> 
> I tried looking into "boosting" "boost\_field" etc and simply do not  
> understand how to approach this.
> 
> Combining with the search term...  
> Ideally, the higher the population - the higher the relevance...?
> 
> Any clues?
> 
> miami\_search.png  
> 40KViewDownload

---

<div class="post-metadata">

**Author:** ![Joshua\_Rountree](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rountree/32/2959_2.png) [@Joshua\_Rountree](https://discuss.elastic.co/u/Joshua_Rountree)\
**Post date:** [March 9, 2012, 1:58pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/4 "2012-03-09T13:58:25Z")

</div>

Worked like a charm... Thank you Thank you!  
Miami Beach still isn't SECOND but I think I just need to weight population  
some how...  
Any ideas on how to weight based on a dynamic integer?  
Somehow make the boost in rank by population?  
Some equation ?

Or should I create a new field in my database that stores a predefined  
"boost" value?

Sincerely,  
Joshua F. Rountree

On Friday, March 9, 2012 2:16:19 AM UTC-5, Radu Gheorghe wrote:

> Hi Joshua,
> 
> The text query should do the trick:  
> curl -XGET [http://localhost:9200/\_search?pretty=true](http://localhost:9200/_search?pretty=true) -d '{  
> "query" : {  
> "text" : {  
> "message" : "Miami FL"  
> }  
> }  
> }'
> 
> First results would be those that contain both Miami and FL.
> 
> You can also try a bool query:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html)
> 
> Then you can put some queries as "must" (need to match to return a  
> hit) and some as "should" (hit is still returned even if the document  
> doesn't match, but I assume it has a higher score).
> 
> Hope this helps. I'm also in a steep ES learning curve 🙂
> 
> Best regards,  
> Radu
> 
> On Mar 9, 12:00 am, Joshua Rountree [jos...@remote-app.com](mailto:jos...@remote-app.com) wrote:
> 
> > I'm new to Elasticsearch...  
> > First off, I love this so far (I think)....
> > 
> > The documentation confuses me.
> > 
> > So I've indexed some geonames data from a mysql table.  
> > It has a field that contains things like:  
> > "Miami FL Florida USA US United States"
> > 
> > Whatever...
> > 
> > So, for the most part with MOST CITIES it returns perfectly accurate  
> > results.
> > 
> > But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL,  
> > I'm  
> > getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> > results.
> > 
> > So I thought to myself... I need to boost based on POPULATION somehow...
> > 
> > Is this possible?
> > 
> > I tried looking into "boosting" "boost\_field" etc and simply do not  
> > understand how to approach this.
> > 
> > Combining with the search term...  
> > Ideally, the higher the population - the higher the relevance...?
> > 
> > Any clues?
> > 
> > miami\_search.png  
> > 40KViewDownload

---

<div class="post-metadata">

**Author:** ![egaumer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/egaumer/32/2365_2.png) [@egaumer](https://discuss.elastic.co/u/egaumer)\
**Post date:** [March 9, 2012, 2:37pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/5 "2012-03-09T14:37:24Z")

</div>

You could try sorting by population (just index a population field) but  
that might be too rigid (very easy and quick to test though).

Have a look at the custom score query. You could factor in the population  
with regards to scoring.

> **[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.

-Eric

On Friday, March 9, 2012 8:58:25 AM UTC-5, Joshua Rountree wrote:

> Worked like a charm... Thank you Thank you!  
> Miami Beach still isn't SECOND but I think I just need to weight  
> population some how...  
> Any ideas on how to weight based on a dynamic integer?  
> Somehow make the boost in rank by population?  
> Some equation ?
> 
> Or should I create a new field in my database that stores a predefined  
> "boost" value?
> 
> Sincerely,  
> Joshua F. Rountree
> 
> On Friday, March 9, 2012 2:16:19 AM UTC-5, Radu Gheorghe wrote:
> 
> > Hi Joshua,
> > 
> > The text query should do the trick:  
> > curl -XGET [http://localhost:9200/\_search?pretty=true](http://localhost:9200/_search?pretty=true) -d '{  
> > "query" : {  
> > "text" : {  
> > "message" : "Miami FL"  
> > }  
> > }  
> > }'
> > 
> > First results would be those that contain both Miami and FL.
> > 
> > You can also try a bool query:
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html)
> > 
> > Then you can put some queries as "must" (need to match to return a  
> > hit) and some as "should" (hit is still returned even if the document  
> > doesn't match, but I assume it has a higher score).
> > 
> > Hope this helps. I'm also in a steep ES learning curve 🙂
> > 
> > Best regards,  
> > Radu
> > 
> > On Mar 9, 12:00 am, Joshua Rountree [jos...@remote-app.com](mailto:jos...@remote-app.com) wrote:
> > 
> > > I'm new to Elasticsearch...  
> > > First off, I love this so far (I think)....
> > > 
> > > The documentation confuses me.
> > > 
> > > So I've indexed some geonames data from a mysql table.  
> > > It has a field that contains things like:  
> > > "Miami FL Florida USA US United States"
> > > 
> > > Whatever...
> > > 
> > > So, for the most part with MOST CITIES it returns perfectly accurate  
> > > results.
> > > 
> > > But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL,  
> > > I'm  
> > > getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> > > results.
> > > 
> > > So I thought to myself... I need to boost based on POPULATION  
> > > somehow...
> > > 
> > > Is this possible?
> > > 
> > > I tried looking into "boosting" "boost\_field" etc and simply do not  
> > > understand how to approach this.
> > > 
> > > Combining with the search term...  
> > > Ideally, the higher the population - the higher the relevance...?
> > > 
> > > Any clues?
> > > 
> > > miami\_search.png  
> > > 40KViewDownload

---

<div class="post-metadata">

**Author:** ![Joshua\_Rountree](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rountree/32/2959_2.png) [@Joshua\_Rountree](https://discuss.elastic.co/u/Joshua_Rountree)\
**Post date:** [March 9, 2012, 9:38pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/6 "2012-03-09T21:38:26Z")

</div>

Okay, and how would I pick up "partial" matches?

Like as they type "Miam"?  
Keep in mind, I'd like all of this wrapped into one query, is that possible?

On Thursday, March 8, 2012 5:00:12 PM UTC-5, Joshua Rountree wrote:

> I'm new to Elasticsearch...  
> First off, I love this so far (I think)....
> 
> The documentation confuses me.
> 
> So I've indexed some geonames data from a mysql table.  
> It has a field that contains things like:  
> "Miami FL Florida USA US United States"
> 
> Whatever...
> 
> So, for the most part with MOST CITIES it returns perfectly accurate  
> results.
> 
> But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL,  
> I'm getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> results.
> 
> So I thought to myself... I need to boost based on POPULATION somehow...
> 
> Is this possible?
> 
> I tried looking into "boosting" "boost\_field" etc and simply do not  
> understand how to approach this.
> 
> Combining with the search term...  
> Ideally, the higher the population - the higher the relevance...?
> 
> Any clues?

---

<div class="post-metadata">

**Author:** ![egaumer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/egaumer/32/2365_2.png) [@egaumer](https://discuss.elastic.co/u/egaumer)\
**Post date:** [March 9, 2012, 9:57pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/7 "2012-03-09T21:57:37Z")

</div>

What do you mean by partial matches? Like an auto-suggest type ahead  
feature?

-Eric

On Friday, March 9, 2012 4:38:26 PM UTC-5, Joshua Rountree wrote:

> Okay, and how would I pick up "partial" matches?
> 
> Like as they type "Miam"?  
> Keep in mind, I'd like all of this wrapped into one query, is that  
> possible?
> 
> On Thursday, March 8, 2012 5:00:12 PM UTC-5, Joshua Rountree wrote:
> 
> > I'm new to Elasticsearch...  
> > First off, I love this so far (I think)....
> > 
> > The documentation confuses me.
> > 
> > So I've indexed some geonames data from a mysql table.  
> > It has a field that contains things like:  
> > "Miami FL Florida USA US United States"
> > 
> > Whatever...
> > 
> > So, for the most part with MOST CITIES it returns perfectly accurate  
> > results.
> > 
> > But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL,  
> > I'm getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> > results.
> > 
> > So I thought to myself... I need to boost based on POPULATION somehow...
> > 
> > Is this possible?
> > 
> > I tried looking into "boosting" "boost\_field" etc and simply do not  
> > understand how to approach this.
> > 
> > Combining with the search term...  
> > Ideally, the higher the population - the higher the relevance...?
> > 
> > Any clues?

---

<div class="post-metadata">

**Author:** ![Joshua\_Rountree](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rountree/32/2959_2.png) [@Joshua\_Rountree](https://discuss.elastic.co/u/Joshua_Rountree)\
**Post date:** [March 9, 2012, 10:09pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/8 "2012-03-09T22:09:53Z")

</div>

Yeah, I was just about to reply again and say I found how to do it in the  
docs...  
Is "phrase\_prefix" an acceptable way to handle it?

On Friday, March 9, 2012 4:57:37 PM UTC-5, egaumer wrote:

> What do you mean by partial matches? Like an auto-suggest type ahead  
> feature?
> 
> -Eric
> 
> On Friday, March 9, 2012 4:38:26 PM UTC-5, Joshua Rountree wrote:
> 
> > Okay, and how would I pick up "partial" matches?
> > 
> > Like as they type "Miam"?  
> > Keep in mind, I'd like all of this wrapped into one query, is that  
> > possible?
> > 
> > On Thursday, March 8, 2012 5:00:12 PM UTC-5, Joshua Rountree wrote:
> > 
> > > I'm new to Elasticsearch...  
> > > First off, I love this so far (I think)....
> > > 
> > > The documentation confuses me.
> > > 
> > > So I've indexed some geonames data from a mysql table.  
> > > It has a field that contains things like:  
> > > "Miami FL Florida USA US United States"
> > > 
> > > Whatever...
> > > 
> > > So, for the most part with MOST CITIES it returns perfectly accurate  
> > > results.
> > > 
> > > But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL,  
> > > I'm getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> > > results.
> > > 
> > > So I thought to myself... I need to boost based on POPULATION somehow...
> > > 
> > > Is this possible?
> > > 
> > > I tried looking into "boosting" "boost\_field" etc and simply do not  
> > > understand how to approach this.
> > > 
> > > Combining with the search term...  
> > > Ideally, the higher the population - the higher the relevance...?
> > > 
> > > Any clues?

---

<div class="post-metadata">

**Author:** ![Joshua\_Rountree](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rountree/32/2959_2.png) [@Joshua\_Rountree](https://discuss.elastic.co/u/Joshua_Rountree)\
**Post date:** [March 9, 2012, 10:11pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/9 "2012-03-09T22:11:58Z")

</div>

Blah, nevermind...  
Now things like "Miami Florida" bomb out...  
;(

On Friday, March 9, 2012 4:57:37 PM UTC-5, egaumer wrote:

> What do you mean by partial matches? Like an auto-suggest type ahead  
> feature?
> 
> -Eric
> 
> On Friday, March 9, 2012 4:38:26 PM UTC-5, Joshua Rountree wrote:
> 
> > Okay, and how would I pick up "partial" matches?
> > 
> > Like as they type "Miam"?  
> > Keep in mind, I'd like all of this wrapped into one query, is that  
> > possible?
> > 
> > On Thursday, March 8, 2012 5:00:12 PM UTC-5, Joshua Rountree wrote:
> > 
> > > I'm new to Elasticsearch...  
> > > First off, I love this so far (I think)....
> > > 
> > > The documentation confuses me.
> > > 
> > > So I've indexed some geonames data from a mysql table.  
> > > It has a field that contains things like:  
> > > "Miami FL Florida USA US United States"
> > > 
> > > Whatever...
> > > 
> > > So, for the most part with MOST CITIES it returns perfectly accurate  
> > > results.
> > > 
> > > But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL,  
> > > I'm getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> > > results.
> > > 
> > > So I thought to myself... I need to boost based on POPULATION somehow...
> > > 
> > > Is this possible?
> > > 
> > > I tried looking into "boosting" "boost\_field" etc and simply do not  
> > > understand how to approach this.
> > > 
> > > Combining with the search term...  
> > > Ideally, the higher the population - the higher the relevance...?
> > > 
> > > Any clues?

---

<div class="post-metadata">

**Author:** ![egaumer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/egaumer/32/2365_2.png) [@egaumer](https://discuss.elastic.co/u/egaumer)\
**Post date:** [March 9, 2012, 10:48pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/10 "2012-03-09T22:48:40Z")

</div>

Executing this type of search requires a more efficient indexing strategy.  
Generally speaking, you need to use an n-gram analyzer to break each token  
down. Once you have this, you can do fast prefix searches across the  
content. For example, here is a demo we did for a customer.

[![]( " - YouTube") ](https://www.youtube.com/watch?v=yFTdh0ahx90)

Clinton wrote a small tutorial on Stack Overflow that outlines some of the  
techniques and procedures. Have a look.

> <https://stackoverflow.com/questions/9421358/filename-search-with-elasticsearch>

If your document count is small enough, you might get by with a simpler  
solution.

-Eric

On Friday, March 9, 2012 5:09:53 PM UTC-5, Joshua Rountree wrote:

> Yeah, I was just about to reply again and say I found how to do it in the  
> docs...  
> Is "phrase\_prefix" an acceptable way to handle it?
> 
> On Friday, March 9, 2012 4:57:37 PM UTC-5, egaumer wrote:
> 
> > What do you mean by partial matches? Like an auto-suggest type ahead  
> > feature?
> > 
> > -Eric
> > 
> > On Friday, March 9, 2012 4:38:26 PM UTC-5, Joshua Rountree wrote:
> > 
> > > Okay, and how would I pick up "partial" matches?
> > > 
> > > Like as they type "Miam"?  
> > > Keep in mind, I'd like all of this wrapped into one query, is that  
> > > possible?
> > > 
> > > On Thursday, March 8, 2012 5:00:12 PM UTC-5, Joshua Rountree wrote:
> > > 
> > > > I'm new to Elasticsearch...  
> > > > First off, I love this so far (I think)....
> > > > 
> > > > The documentation confuses me.
> > > > 
> > > > So I've indexed some geonames data from a mysql table.  
> > > > It has a field that contains things like:  
> > > > "Miami FL Florida USA US United States"
> > > > 
> > > > Whatever...
> > > > 
> > > > So, for the most part with MOST CITIES it returns perfectly accurate  
> > > > results.
> > > > 
> > > > But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI FL,  
> > > > I'm getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> > > > results.
> > > > 
> > > > So I thought to myself... I need to boost based on POPULATION somehow...
> > > > 
> > > > Is this possible?
> > > > 
> > > > I tried looking into "boosting" "boost\_field" etc and simply do not  
> > > > understand how to approach this.
> > > > 
> > > > Combining with the search term...  
> > > > Ideally, the higher the population - the higher the relevance...?
> > > > 
> > > > Any clues?

---

<div class="post-metadata">

**Author:** ![Joshua\_Rountree](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_rountree/32/2959_2.png) [@Joshua\_Rountree](https://discuss.elastic.co/u/Joshua_Rountree)\
**Post date:** [March 9, 2012, 11:50pm UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/11 "2012-03-09T23:50:08Z")

</div>

How about I use two separate fields and then combine the scores?  
SOmehow?

My main goal is to get this:  
Miami FL could be found in one field or Miami Florida could be found in the  
other...?  
That's as advanced as I need...

If both are the same record then combine the scores maybe?

Maybe I'm being a total n00b?

On Friday, March 9, 2012 5:48:40 PM UTC-5, egaumer wrote:

> Executing this type of search requires a more efficient indexing strategy.  
> Generally speaking, you need to use an n-gram analyzer to break each token  
> down. Once you have this, you can do fast prefix searches across the  
> content. For example, here is a demo we did for a customer.
> 
> [http://youtu.be/yFTdh0ahx90](http://youtu.be/yFTdh0ahx90)
> 
> Clinton wrote a small tutorial on Stack Overflow that outlines some of the  
> techniques and procedures. Have a look.
> 
> [lucene - Filename search with ElasticSearch - Stack Overflow](http://stackoverflow.com/questions/9421358/filename-search-with-elasticsearch)
> 
> If your document count is small enough, you might get by with a simpler  
> solution.
> 
> -Eric
> 
> On Friday, March 9, 2012 5:09:53 PM UTC-5, Joshua Rountree wrote:
> 
> > Yeah, I was just about to reply again and say I found how to do it in the  
> > docs...  
> > Is "phrase\_prefix" an acceptable way to handle it?
> > 
> > On Friday, March 9, 2012 4:57:37 PM UTC-5, egaumer wrote:
> > 
> > > What do you mean by partial matches? Like an auto-suggest type ahead  
> > > feature?
> > > 
> > > -Eric
> > > 
> > > On Friday, March 9, 2012 4:38:26 PM UTC-5, Joshua Rountree wrote:
> > > 
> > > > Okay, and how would I pick up "partial" matches?
> > > > 
> > > > Like as they type "Miam"?  
> > > > Keep in mind, I'd like all of this wrapped into one query, is that  
> > > > possible?
> > > > 
> > > > On Thursday, March 8, 2012 5:00:12 PM UTC-5, Joshua Rountree wrote:
> > > > 
> > > > > I'm new to Elasticsearch...  
> > > > > First off, I love this so far (I think)....
> > > > > 
> > > > > The documentation confuses me.
> > > > > 
> > > > > So I've indexed some geonames data from a mysql table.  
> > > > > It has a field that contains things like:  
> > > > > "Miami FL Florida USA US United States"
> > > > > 
> > > > > Whatever...
> > > > > 
> > > > > So, for the most part with MOST CITIES it returns perfectly accurate  
> > > > > results.
> > > > > 
> > > > > But if I search "Miami FL" or "Miami Florida" I'm not getting MIAMI  
> > > > > FL, I'm getting Miami Gardens, FL, etc. Miami FL shows up like #10 in the  
> > > > > results.
> > > > > 
> > > > > So I thought to myself... I need to boost based on POPULATION  
> > > > > somehow...
> > > > > 
> > > > > Is this possible?
> > > > > 
> > > > > I tried looking into "boosting" "boost\_field" etc and simply do not  
> > > > > understand how to approach this.
> > > > > 
> > > > > Combining with the search term...  
> > > > > Ideally, the higher the population - the higher the relevance...?
> > > > > 
> > > > > Any clues?

---

<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:36am UTC](https://discuss.elastic.co/t/having-trouble-querying-boosting-learning-curve-i-suspect-please-help/6954/12 "2017-07-06T03:36:27Z")

</div>


