# Vague Searches

**URL:** <https://discuss.elastic.co/t/vague-searches/6446>\
**Category:** Elasticsearch\
**Created:** [January 19, 2012, 10:06pm UTC](https://discuss.elastic.co/t/vague-searches/6446 "2012-01-19T22:06:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_4/32/3017_2.png) [@Jason\_4](https://discuss.elastic.co/u/Jason_4)\
**Post date:** [January 19, 2012, 10:06pm UTC](https://discuss.elastic.co/t/vague-searches/6446/1 "2012-01-19T22:06:12Z")

</div>

I'm trying to figure out the best approach to handling a "vague"  
search. Say I have a document with a string attribute '123 Main St,  
Boston, MA, 02118' I'd like to be able to search for it using '123  
Main Boston' and 'Main St, 02118', etc. I've run into issues with  
both Text and Terms searches in that there are too many matches on  
'Boston' or '02118'. I have indexes on the address parts (number,  
street, town, state, zip), but using Or or Should, I run into the same  
problem, too many results. Is there a way to boost the number and  
address as part of an Or Terms match?

---

<div class="post-metadata">

**Author:** ![Jan\_Fiedler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jan_fiedler/32/2518_2.png) [@Jan\_Fiedler](https://discuss.elastic.co/u/Jan_Fiedler)\
**Post date:** [January 20, 2012, 4:08pm UTC](https://discuss.elastic.co/t/vague-searches/6446/2 "2012-01-20T16:08:13Z")

</div>

For searches on the full address field I'd recommend setting the operator  
of the text query to 'and'. This should make sure all the terms the user  
entered are (somehow) part of the indexed address. This approach will  
provide no results if the user entered terms that are not part of the  
address. In such a case you could fallback to an 'or' text search.

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [January 21, 2012, 8:49pm UTC](https://discuss.elastic.co/t/vague-searches/6446/3 "2012-01-21T20:49:02Z")

</div>

Probably with a combination of this:

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

and boosting while indexing you can reach your goal (?)

Peter.

On 19 Jan., 23:06, Jason [jvanderh...@gmail.com](mailto:jvanderh...@gmail.com) wrote:

> I'm trying to figure out the best approach to handling a "vague"  
> search. Say I have a document with a string attribute '123 Main St,  
> Boston, MA, 02118' I'd like to be able to search for it using '123  
> Main Boston' and 'Main St, 02118', etc. I've run into issues with  
> both Text and Terms searches in that there are too many matches on  
> 'Boston' or '02118'. I have indexes on the address parts (number,  
> street, town, state, zip), but using Or or Should, I run into the same  
> problem, too many results. Is there a way to boost the number and  
> address as part of an Or Terms match?

---

<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:** [January 23, 2012, 6:54pm UTC](https://discuss.elastic.co/t/vague-searches/6446/4 "2012-01-23T18:54:08Z")

</div>

Another option is to use the more like this query.

On Sat, Jan 21, 2012 at 10:49 PM, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com)wrote:

> Probably with a combination of this:
> 
> [http://www.elasticsearch.org/guide/reference/query-dsl/custom-filters-score-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/custom-filters-score-query.html)
> 
> and boosting while indexing you can reach your goal (?)
> 
> Peter.
> 
> On 19 Jan., 23:06, Jason [jvanderh...@gmail.com](mailto:jvanderh...@gmail.com) wrote:
> 
> > I'm trying to figure out the best approach to handling a "vague"  
> > search. Say I have a document with a string attribute '123 Main St,  
> > Boston, MA, 02118' I'd like to be able to search for it using '123  
> > Main Boston' and 'Main St, 02118', etc. I've run into issues with  
> > both Text and Terms searches in that there are too many matches on  
> > 'Boston' or '02118'. I have indexes on the address parts (number,  
> > street, town, state, zip), but using Or or Should, I run into the same  
> > problem, too many results. Is there a way to boost the number and  
> > address as part of an Or Terms match?

---

<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:41am UTC](https://discuss.elastic.co/t/vague-searches/6446/5 "2017-07-06T03:41:50Z")

</div>


