# Database LIKE 'something mor%' query

**URL:** <https://discuss.elastic.co/t/database-like-something-mor-query/5561>\
**Category:** Elasticsearch\
**Created:** [October 11, 2011, 12:40pm UTC](https://discuss.elastic.co/t/database-like-something-mor-query/5561 "2011-10-11T12:40:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Nemsadze](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexander_nemsadze/32/3114_2.png) [@Alexander\_Nemsadze](https://discuss.elastic.co/u/Alexander_Nemsadze)\
**Post date:** [October 11, 2011, 12:40pm UTC](https://discuss.elastic.co/t/database-like-something-mor-query/5561/1 "2011-10-11T12:40:31Z")

</div>

We want to get elasticsearch to search for us exactly as database LIKE  
'something mor%' query does and with highlights in particular case.  
Any ideas?

---

<div class="post-metadata">

**Author:** ![Baishampayan\_Ghose](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/baishampayan_ghose/32/2815_2.png) [@Baishampayan\_Ghose](https://discuss.elastic.co/u/Baishampayan_Ghose)\
**Post date:** [October 11, 2011, 12:42pm UTC](https://discuss.elastic.co/t/database-like-something-mor-query/5561/2 "2011-10-11T12:42:11Z")

</div>

On Tue, Oct 11, 2011 at 6:10 PM, Alexander Nemsadze  
[alexander.nemsadze@azry.com](mailto:alexander.nemsadze@azry.com) wrote:

> We want to get elasticsearch to search for us exactly as database LIKE  
> 'something mor%' query does and with highlights in particular case.  
> Any ideas?

Elasticsearch supports "more like this" queries. More details -

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

Regards,  
BG

--  
Baishampayan Ghose  
b.ghose at [gmail.com](http://gmail.com)

---

<div class="post-metadata">

**Author:** ![Chris\_Berkhout](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_berkhout/32/3058_2.png) [@Chris\_Berkhout](https://discuss.elastic.co/u/Chris_Berkhout)\
**Post date:** [October 11, 2011, 12:48pm UTC](https://discuss.elastic.co/t/database-like-something-mor-query/5561/3 "2011-10-11T12:48:37Z")

</div>

If you're just talking about finding things starting with a given string, like:

some\_field LIKE 'something mor%'  
some\_field LIKE 'first second %'  
some\_field LIKE 'another cas%'

You should check out prefix queries:

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

Does that help?

Cheers,  
Chris

On Tue, Oct 11, 2011 at 8:40 PM, Alexander Nemsadze  
[alexander.nemsadze@azry.com](mailto:alexander.nemsadze@azry.com) wrote:

> We want to get elasticsearch to search for us exactly as database LIKE  
> 'something mor%' query does and with highlights in particular case.  
> Any ideas?

---

<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:** [October 11, 2011, 3:13pm UTC](https://discuss.elastic.co/t/database-like-something-mor-query/5561/4 "2011-10-11T15:13:50Z")

</div>

for best performance you'll need to use (edge)ngram filter/tokenizer  
for indexing

> **[Home](https://lucidworks.com/)**
>
> Lucidworks' Fusion platform uses industry-leading search technology to power search & discovery for the largest & most successful companies. Request a demo today.

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

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

- prefix query or 'something mor\*' query\_string queries

On 11 Okt., 14:40, Alexander Nemsadze [alexander.nemsa...@azry.com](mailto:alexander.nemsa...@azry.com)  
wrote:

> We want to get elasticsearch to search for us exactly as database LIKE  
> 'something mor%' query does and with highlights in particular case.  
> Any ideas?

---

<div class="post-metadata">

**Author:** ![Alexander\_Nemsadze](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexander_nemsadze/32/3114_2.png) [@Alexander\_Nemsadze](https://discuss.elastic.co/u/Alexander_Nemsadze)\
**Post date:** [October 11, 2011, 3:14pm UTC](https://discuss.elastic.co/t/database-like-something-mor-query/5561/5 "2011-10-11T15:14:30Z")

</div>

Unfortunately prefix works only for one word.

some\_field LIKE 'somet%' - Works  
some\_field LIKE 'something mor%' - Does not work  
some\_field LIKE 'something more%' - Also does not work

On Oct 11, 4:48 pm, Chris Berkhout [chrisberkh...@gmail.com](mailto:chrisberkh...@gmail.com) wrote:

> If you're just talking about finding things starting with a given string, like:
> 
> some\_field LIKE 'something mor%'  
> some\_field LIKE 'first second %'  
> some\_field LIKE 'another cas%'
> 
> You should check out prefix queries:[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)
> 
> Does that help?
> 
> Cheers,  
> Chris
> 
> On Tue, Oct 11, 2011 at 8:40 PM, Alexander Nemsadze
> 
> [alexander.nemsa...@azry.com](mailto:alexander.nemsa...@azry.com) wrote:
> 
> > We want to get elasticsearch to search for us exactly as database LIKE  
> > 'something mor%' query does and with highlights in particular case.  
> > Any ideas?

---

<div class="post-metadata">

**Author:** ![Jurgen\_kartnaller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jurgen_kartnaller/32/3086_2.png) [@Jurgen\_kartnaller](https://discuss.elastic.co/u/Jurgen_kartnaller)\
**Post date:** [October 12, 2011, 5:25am UTC](https://discuss.elastic.co/t/database-like-something-mor-query/5561/6 "2011-10-12T05:25:13Z")

</div>

On Tue, Oct 11, 2011 at 5:14 PM, Alexander Nemsadze \<  
[alexander.nemsadze@azry.com](mailto:alexander.nemsadze@azry.com)\> wrote:

> Unfortunately prefix works only for one word.

I guess you shoud use a not analyzed field.

> some\_field LIKE 'somet%' - Works  
> some\_field LIKE 'something mor%' - Does not work  
> some\_field LIKE 'something more%' - Also does not work
> 
> On Oct 11, 4:48 pm, Chris Berkhout [chrisberkh...@gmail.com](mailto:chrisberkh...@gmail.com) wrote:
> 
> > If you're just talking about finding things starting with a given string,  
> > like:
> > 
> > some\_field LIKE 'something mor%'  
> > some\_field LIKE 'first second %'  
> > some\_field LIKE 'another cas%'
> > 
> > You should check out prefix queries:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)
> > 
> > Does that help?
> > 
> > Cheers,  
> > Chris
> > 
> > On Tue, Oct 11, 2011 at 8:40 PM, Alexander Nemsadze
> > 
> > [alexander.nemsa...@azry.com](mailto:alexander.nemsa...@azry.com) wrote:
> > 
> > > We want to get elasticsearch to search for us exactly as database LIKE  
> > > 'something mor%' query does and with highlights in particular case.  
> > > Any ideas?

--  
[http://www.sfgdornbirn.at](http://www.sfgdornbirn.at)  
[http://www.mcb-bregenz.at](http://www.mcb-bregenz.at)

---

<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:52am UTC](https://discuss.elastic.co/t/database-like-something-mor-query/5561/7 "2017-07-06T03:52:19Z")

</div>


