# Completion suggest question

**URL:** <https://discuss.elastic.co/t/completion-suggest-question/13283>\
**Category:** Elasticsearch\
**Created:** [August 21, 2013, 10:16am UTC](https://discuss.elastic.co/t/completion-suggest-question/13283 "2013-08-21T10:16:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![wrongmind](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wrongmind](https://discuss.elastic.co/u/wrongmind)\
**Post date:** [August 21, 2013, 10:16am UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/1 "2013-08-21T10:16:23Z")

</div>

Hello Everyone,

I'm new to elasticsearch and I'm doing some experiments with the completion  
suggest feature.  
I was wondering if using a string array as 'input' parameter when indexing,  
as in the example on the guide

"input": ["Nevermind", "Nirvana"]

is there anyway to use multiple prefixes in the suggest query? Something  
like:

{  
"song-suggest" : {  
"text" : "nev nir",  
"completion" : {  
"field" : "suggest"  
}  
}  
}

Or is there any mapping for the completion type that would allow a similar  
suggest query?

Thanks for any help

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [August 21, 2013, 12:28pm UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/2 "2013-08-21T12:28:22Z")

</div>

so you want us to expand all the term in you query? I think you should send  
multiple prefix requests instead one with "nir" one with "nev".  
I really can't entirely figure out when you would have a need for something  
like this to be honest. can you provide a usecase that migh tmake it easier  
to help you.

simon

On Wednesday, August 21, 2013 12:16:23 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:

> Hello Everyone,
> 
> I'm new to elasticsearch and I'm doing some experiments with the  
> completion suggest feature.  
> I was wondering if using a string array as 'input' parameter when  
> indexing, as in the example on the guide
> 
> "input": ["Nevermind", "Nirvana"]
> 
> is there anyway to use multiple prefixes in the suggest query? Something  
> like:
> 
> {  
> "song-suggest" : {  
> "text" : "nev nir",  
> "completion" : {  
> "field" : "suggest"  
> }  
> }  
> }
> 
> Or is there any mapping for the completion type that would allow a similar  
> suggest query?
> 
> Thanks for any help

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![wrongmind](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wrongmind](https://discuss.elastic.co/u/wrongmind)\
**Post date:** [August 22, 2013, 4:04pm UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/3 "2013-08-22T16:04:30Z")

</div>

By multiple prefix request do you mean something like

{  
"song-suggest" : {  
"text" : "nev",  
"completion" : {  
"field" : "suggest"  
}  
}  
"song-suggest2" : {  
"text" : "nir",  
"completion" : {  
"field" : "suggest"  
}  
}  
}

Is there a way to use an AND operator on the results of the two requests?

The use case would be searching for more than one prefix at a time,  
possibly "out of order"  
Given an input like the following one, a possible query would be on "smell  
spir".

"input": ["smell", "like", "teen", spirit"]

But it's probably not what the completion suggest was meant for.

Thanks

On Wednesday, 21 August 2013 13:28:22 UTC+1, simonw wrote:

> so you want us to expand all the term in you query? I think you should  
> send multiple prefix requests instead one with "nir" one with "nev".  
> I really can't entirely figure out when you would have a need for  
> something like this to be honest. can you provide a usecase that migh tmake  
> it easier to help you.
> 
> simon
> 
> On Wednesday, August 21, 2013 12:16:23 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:
> 
> > Hello Everyone,
> > 
> > I'm new to elasticsearch and I'm doing some experiments with the  
> > completion suggest feature.  
> > I was wondering if using a string array as 'input' parameter when  
> > indexing, as in the example on the guide
> > 
> > "input": ["Nevermind", "Nirvana"]
> > 
> > is there anyway to use multiple prefixes in the suggest query? Something  
> > like:
> > 
> > {  
> > "song-suggest" : {  
> > "text" : "nev nir",  
> > "completion" : {  
> > "field" : "suggest"  
> > }  
> > }  
> > }
> > 
> > Or is there any mapping for the completion type that would allow a  
> > similar suggest query?
> > 
> > Thanks for any help

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [August 22, 2013, 6:53pm UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/4 "2013-08-22T18:53:08Z")

</div>

On Thursday, August 22, 2013 6:04:30 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:

> By multiple prefix request do you mean something like

yes!

> {  
> "song-suggest" : {  
> "text" : "nev",  
> "completion" : {  
> "field" : "suggest"  
> }  
> }  
> "song-suggest2" : {  
> "text" : "nir",  
> "completion" : {  
> "field" : "suggest"  
> }  
> }  
> }
> 
> Is there a way to use an AND operator on the results of the two requests?
> 
> The use case would be searching for more than one prefix at a time,  
> possibly "out of order"  
> Given an input like the following one, a possible query would be on "smell  
> spir".
> 
> "input": ["smell", "like", "teen", spirit"]
> 
> But it's probably not what the completion suggest was meant for.

I don't if I understand the usecase here. what would you expecte as the  
output here?

> Thanks
> 
> On Wednesday, 21 August 2013 13:28:22 UTC+1, simonw wrote:
> 
> > so you want us to expand all the term in you query? I think you should  
> > send multiple prefix requests instead one with "nir" one with "nev".  
> > I really can't entirely figure out when you would have a need for  
> > something like this to be honest. can you provide a usecase that migh tmake  
> > it easier to help you.
> > 
> > simon
> > 
> > On Wednesday, August 21, 2013 12:16:23 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:
> > 
> > > Hello Everyone,
> > > 
> > > I'm new to elasticsearch and I'm doing some experiments with the  
> > > completion suggest feature.  
> > > I was wondering if using a string array as 'input' parameter when  
> > > indexing, as in the example on the guide
> > > 
> > > "input": ["Nevermind", "Nirvana"]
> > > 
> > > is there anyway to use multiple prefixes in the suggest query? Something  
> > > like:
> > > 
> > > {  
> > > "song-suggest" : {  
> > > "text" : "nev nir",  
> > > "completion" : {  
> > > "field" : "suggest"  
> > > }  
> > > }  
> > > }
> > > 
> > > Or is there any mapping for the completion type that would allow a  
> > > similar suggest query?
> > > 
> > > Thanks for any help

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![wrongmind](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wrongmind](https://discuss.elastic.co/u/wrongmind)\
**Post date:** [August 22, 2013, 8:31pm UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/5 "2013-08-22T20:31:55Z")

</div>

2013/8/22 simonw [simon.willnauer@elasticsearch.com](mailto:simon.willnauer@elasticsearch.com)

> On Thursday, August 22, 2013 6:04:30 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:
> 
> > By multiple prefix request do you mean something like
> 
> yes!

Is it possible to combine them with an AND?

The use case would be searching for more than one prefix at a time,  
possibly "out of order"  
Given an input like the following one, a possible query would be on "smell  
spir".

"input": ["smell", "like", "teen", spirit"]

But it's probably not what the completion suggest was meant for.

> I don't if I understand the usecase here. what would you expecte as the  
> output here?

Let's say I have two documents, the first one

"input": ["smells", "like", "teen", "spirit"]

"output": "Smells like teen spirit"

and the second one

"input": ["smells", "like", "children"]  
"output": "Smells like children"

I'd like to search with more than one prefix at once. Searching for "smel"  
and "spir" together should return "Smells like teen spirit"

It the title is a string field indexed with a standard analyzer it is  
possible to use a prefix filter for each of the search terms and combine  
them with an and filter.  
Is there a way to obtain a similar thing with the completion suggest?

Thanks

On Wednesday, 21 August 2013 13:28:22 UTC+1, simonw wrote:

> > > so you want us to expand all the term in you query? I think you should  
> > > send multiple prefix requests instead one with "nir" one with "nev".  
> > > I really can't entirely figure out when you would have a need for  
> > > something like this to be honest. can you provide a usecase that migh tmake  
> > > it easier to help you.
> > > 
> > > simon
> > > 
> > > On Wednesday, August 21, 2013 12:16:23 PM UTC+2, wron...@gmail.comwrote:
> > > 
> > > > Hello Everyone,
> > > > 
> > > > I'm new to elasticsearch and I'm doing some experiments with the  
> > > > completion suggest feature.  
> > > > I was wondering if using a string array as 'input' parameter when  
> > > > indexing, as in the example on the guide
> > > > 
> > > > "input": ["Nevermind", "Nirvana"]
> > > > 
> > > > is there anyway to use multiple prefixes in the suggest query?  
> > > > Something like:
> > > > 
> > > > {  
> > > > "song-suggest" : {  
> > > > "text" : "nev nir",  
> > > > "completion" : {  
> > > > "field" : "suggest"  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > Or is there any mapping for the completion type that would allow a  
> > > > similar suggest query?
> > > > 
> > > > Thanks for any help
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe](https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe).  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [August 23, 2013, 6:22am UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/6 "2013-08-23T06:22:06Z")

</div>

hey,

On Thursday, August 22, 2013 10:31:55 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:

> 2013/8/22 simonw \<[simon.w...@elasticsearch.com](mailto:simon.w...@elasticsearch.com) \<javascript:\>\>
> 
> > On Thursday, August 22, 2013 6:04:30 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:
> > 
> > > By multiple prefix request do you mean something like
> > 
> > yes!
> 
> Is it possible to combine them with an AND?

not in the suggester sorry.

> The use case would be searching for more than one prefix at a time,  
> possibly "out of order"  
> Given an input like the following one, a possible query would be on "smell  
> spir".
> 
> "input": ["smell", "like", "teen", spirit"]

I don't get why you have this input I'd expect it is

"input" : ["smells like teen spirit"]

no?

> But it's probably not what the completion suggest was meant for.
> 
> > I don't if I understand the usecase here. what would you expecte as the  
> > output here?
> 
> Let's say I have two documents, the first one
> 
> "input": ["smells", "like", "teen", "spirit"]
> 
> "output": "Smells like teen spirit"
> 
> and the second one
> 
> "input": ["smells", "like", "children"]
> 
> "output": "Smells like children"
> 
> I'd like to search with more than one prefix at once. Searching for  
> "smel" and "spir" together should return "Smells like teen spirit"

see, this is what I want to understand... what is the usecase that you need  
to do that? who would type two prefixes?  
I don't want to say that this is wrong I just wanna understand it to give  
you better advice... I'd expect that you get one prefix that could be  
somewhere in the phrase but that is a different problem with different  
solutions.

simon

> It the title is a string field indexed with a standard analyzer it is  
> possible to use a prefix filter for each of the search terms and combine  
> them with an and filter.  
> Is there a way to obtain a similar thing with the completion suggest?

> Thanks
> 
> On Wednesday, 21 August 2013 13:28:22 UTC+1, simonw wrote:
> 
> > > > so you want us to expand all the term in you query? I think you should  
> > > > send multiple prefix requests instead one with "nir" one with "nev".  
> > > > I really can't entirely figure out when you would have a need for  
> > > > something like this to be honest. can you provide a usecase that migh tmake  
> > > > it easier to help you.
> > > > 
> > > > simon
> > > > 
> > > > On Wednesday, August 21, 2013 12:16:23 PM UTC+2, wron...@gmail.comwrote:
> > > > 
> > > > > Hello Everyone,
> > > > > 
> > > > > I'm new to elasticsearch and I'm doing some experiments with the  
> > > > > completion suggest feature.  
> > > > > I was wondering if using a string array as 'input' parameter when  
> > > > > indexing, as in the example on the guide
> > > > > 
> > > > > "input": ["Nevermind", "Nirvana"]
> > > > > 
> > > > > is there anyway to use multiple prefixes in the suggest query?  
> > > > > Something like:
> > > > > 
> > > > > {  
> > > > > "song-suggest" : {  
> > > > > "text" : "nev nir",  
> > > > > "completion" : {  
> > > > > "field" : "suggest"  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > Or is there any mapping for the completion type that would allow a  
> > > > > similar suggest query?
> > > > > 
> > > > > Thanks for any help
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe](https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe).  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![wrongmind](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wrongmind](https://discuss.elastic.co/u/wrongmind)\
**Post date:** [August 23, 2013, 9:13am UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/7 "2013-08-23T09:13:48Z")

</div>

Hi

2013/8/23 simonw [simon.willnauer@elasticsearch.com](mailto:simon.willnauer@elasticsearch.com)

> hey,
> 
> On Thursday, August 22, 2013 10:31:55 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:
> 
> > 2013/8/22 simonw \<simon.w...@\*\*[elasticsearch.com](http://elasticsearch.com)\>
> 
> > The use case would be searching for more than one prefix at a time,  
> > possibly "out of order"  
> > Given an input like the following one, a possible query would be on  
> > "smell spir".
> > 
> > "input": ["smell", "like", "teen", spirit"]
> 
> I don't get why you have this input I'd expect it is
> 
> "input" : ["smells like teen spirit"]
> 
> no?

I'm using the array so I can search for a prefix that is somewhere in the  
phrase. I can use "spir" as text to get the title.  
I've tried a standard analyzer on the suggest field, but it's not allowing  
that kind of search

> But it's probably not what the completion suggest was meant for.
> 
> > > I don't if I understand the usecase here. what would you expecte as the  
> > > output here?
> > 
> > Let's say I have two documents, the first one
> > 
> > "input": ["smells", "like", "teen", "spirit"]
> > 
> > "output": "Smells like teen spirit"
> > 
> > and the second one
> > 
> > "input": ["smells", "like", "children"]
> > 
> > "output": "Smells like children"
> > 
> > I'd like to search with more than one prefix at once. Searching for  
> > "smel" and "spir" together should return "Smells like teen spirit"
> 
> see, this is what I want to understand... what is the usecase that you  
> need to do that? who would type two prefixes?  
> I don't want to say that this is wrong I just wanna understand it to give  
> you better advice... I'd expect that you get one prefix that could be  
> somewhere in the phrase but that is a different problem with different  
> solutions.

It would be an the ability for a user to narrow the search results while  
typing, but using any word in the phrase he's looking for.  
The first word would probably be a complete term, not a prefix, when he  
starts typing the second term.  
For the titles example, it would be someone that starts looking for  
"smells" and after getting the results, he starts typing "chil" for  
example, to narrow the results.

What would be the best approach to this kind of use case?  
And what would be the best way to get a prefix somewhere in the phrase?

Thanks

> It the title is a string field indexed with a standard analyzer it is  
> possible to use a prefix filter for each of the search terms and combine  
> them with an and filter.  
> Is there a way to obtain a similar thing with the completion suggest?

> Thanks
> 
> On Wednesday, 21 August 2013 13:28:22 UTC+1, simonw wrote:
> 
> > > > so you want us to expand all the term in you query? I think you should  
> > > > send multiple prefix requests instead one with "nir" one with "nev".  
> > > > I really can't entirely figure out when you would have a need for  
> > > > something like this to be honest. can you provide a usecase that migh tmake  
> > > > it easier to help you.
> > > > 
> > > > simon
> > > > 
> > > > On Wednesday, August 21, 2013 12:16:23 PM UTC+2, wron...@gmail.comwrote:
> > > > 
> > > > > Hello Everyone,
> > > > > 
> > > > > I'm new to elasticsearch and I'm doing some experiments with the  
> > > > > completion suggest feature.  
> > > > > I was wondering if using a string array as 'input' parameter when  
> > > > > indexing, as in the example on the guide
> > > > > 
> > > > > "input": ["Nevermind", "Nirvana"]
> > > > > 
> > > > > is there anyway to use multiple prefixes in the suggest query?  
> > > > > Something like:
> > > > > 
> > > > > {  
> > > > > "song-suggest" : {  
> > > > > "text" : "nev nir",  
> > > > > "completion" : {  
> > > > > "field" : "suggest"  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > Or is there any mapping for the completion type that would allow a  
> > > > > similar suggest query?
> > > > > 
> > > > > Thanks for any help
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)\*\*  
> > > > > topic/elasticsearch/\*\*9xUcyVIBS3U/unsubscribe[https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe](https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > 
> > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > .
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe](https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [August 23, 2013, 9:24am UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/8 "2013-08-23T09:24:24Z")

</div>

On Friday, August 23, 2013 11:13:48 AM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:

> Hi
> 
> 2013/8/23 simonw \<[simon.w...@elasticsearch.com](mailto:simon.w...@elasticsearch.com) \<javascript:\>\>
> 
> > hey,
> > 
> > On Thursday, August 22, 2013 10:31:55 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:
> > 
> > > 2013/8/22 simonw \<simon.w...@\*\*[elasticsearch.com](http://elasticsearch.com)\>
> > 
> > > The use case would be searching for more than one prefix at a time,  
> > > possibly "out of order"  
> > > Given an input like the following one, a possible query would be on  
> > > "smell spir".
> > > 
> > > "input": ["smell", "like", "teen", spirit"]
> > 
> > I don't get why you have this input I'd expect it is
> > 
> > "input" : ["smells like teen spirit"]
> > 
> > no?
> 
> I'm using the array so I can search for a prefix that is somewhere in the  
> phrase. I can use "spir" as text to get the title.  
> I've tried a standard analyzer on the suggest field, but it's not allowing  
> that kind of search
> 
> > But it's probably not what the completion suggest was meant for.
> > 
> > > > I don't if I understand the usecase here. what would you expecte as the  
> > > > output here?
> > > 
> > > Let's say I have two documents, the first one
> > > 
> > > "input": ["smells", "like", "teen", "spirit"]
> > > 
> > > "output": "Smells like teen spirit"
> > > 
> > > and the second one
> > > 
> > > "input": ["smells", "like", "children"]
> > > 
> > > "output": "Smells like children"
> > > 
> > > I'd like to search with more than one prefix at once. Searching for  
> > > "smel" and "spir" together should return "Smells like teen spirit"
> > 
> > see, this is what I want to understand... what is the usecase that you  
> > need to do that? who would type two prefixes?  
> > I don't want to say that this is wrong I just wanna understand it to give  
> > you better advice... I'd expect that you get one prefix that could be  
> > somewhere in the phrase but that is a different problem with different  
> > solutions.
> 
> It would be an the ability for a user to narrow the search results while  
> typing, but using any word in the phrase he's looking for.  
> The first word would probably be a complete term, not a prefix, when he  
> starts typing the second term.  
> For the titles example, it would be someone that starts looking for  
> "smells" and after getting the results, he starts typing "chil" for  
> example, to narrow the results.
> 
> What would be the best approach to this kind of use case?  
> And what would be the best way to get a prefix somewhere in the phrase?

ok so you wanna display results while the person is typing? I guess a  
edgeNGram approach would be the best for this. I still don't see why I'd  
type "chil" after "smells" if you already display me "smells like children"  
as a query so I can just select it and fire the search. This service is  
more of a query suggestion like you get in google when you start typing.

simon

> Thanks
> 
> > It the title is a string field indexed with a standard analyzer it is  
> > possible to use a prefix filter for each of the search terms and combine  
> > them with an and filter.  
> > Is there a way to obtain a similar thing with the completion suggest?
> 
> > Thanks
> > 
> > On Wednesday, 21 August 2013 13:28:22 UTC+1, simonw wrote:
> > 
> > > > > so you want us to expand all the term in you query? I think you should  
> > > > > send multiple prefix requests instead one with "nir" one with "nev".  
> > > > > I really can't entirely figure out when you would have a need for  
> > > > > something like this to be honest. can you provide a usecase that migh tmake  
> > > > > it easier to help you.
> > > > > 
> > > > > simon
> > > > > 
> > > > > On Wednesday, August 21, 2013 12:16:23 PM UTC+2, wron...@gmail.comwrote:
> > > > > 
> > > > > > Hello Everyone,
> > > > > > 
> > > > > > I'm new to elasticsearch and I'm doing some experiments with the  
> > > > > > completion suggest feature.  
> > > > > > I was wondering if using a string array as 'input' parameter when  
> > > > > > indexing, as in the example on the guide
> > > > > > 
> > > > > > "input": ["Nevermind", "Nirvana"]
> > > > > > 
> > > > > > is there anyway to use multiple prefixes in the suggest query?  
> > > > > > Something like:
> > > > > > 
> > > > > > {  
> > > > > > "song-suggest" : {  
> > > > > > "text" : "nev nir",  
> > > > > > "completion" : {  
> > > > > > "field" : "suggest"  
> > > > > > }  
> > > > > > }  
> > > > > > }
> > > > > > 
> > > > > > Or is there any mapping for the completion type that would allow a  
> > > > > > similar suggest query?
> > > > > > 
> > > > > > Thanks for any help
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to a topic in the  
> > > > > > Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)\*\*  
> > > > > > topic/elasticsearch/\*\*9xUcyVIBS3U/unsubscribe[https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe](https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe](https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![wrongmind](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wrongmind](https://discuss.elastic.co/u/wrongmind)\
**Post date:** [August 23, 2013, 10:06am UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/9 "2013-08-23T10:06:18Z")

</div>

Yes, it's displaying the results while typing. I've tried the approach with  
edgeNGram and the one using prefix filters. The edgeNGram was surprising,  
because it wasn't much faster than the prefix approach.  
I think I'll go with the prefix approach, because the performance gain with  
the edgeNGram doesn't seem worth the increased index size.  
The completion suggest seems much faster, that's why I was trying to make  
it works in this case.

It's returning the top results for "smells" while typing, so maybe "smells  
like children" it's not displayed searching just for "smells". But I agree  
that is probably a strange use case.

Thanks very much for your help.

2013/8/23 simonw [simon.willnauer@elasticsearch.com](mailto:simon.willnauer@elasticsearch.com)

> On Friday, August 23, 2013 11:13:48 AM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:
> 
> > Hi
> > 
> > 2013/8/23 simonw \<simon.w...@\*\*[elasticsearch.com](http://elasticsearch.com)\>
> > 
> > hey,
> > 
> > > On Thursday, August 22, 2013 10:31:55 PM UTC+2, [wron...@gmail.com](mailto:wron...@gmail.com) wrote:
> > > 
> > > > 2013/8/22 simonw \<simon.w...@\*\*[elasticsearch.com](http://elasticsearch.com)\>
> > > 
> > > > The use case would be searching for more than one prefix at a time,  
> > > > possibly "out of order"  
> > > > Given an input like the following one, a possible query would be on  
> > > > "smell spir".
> > > > 
> > > > "input": ["smell", "like", "teen", spirit"]
> > > 
> > > I don't get why you have this input I'd expect it is
> > > 
> > > "input" : ["smells like teen spirit"]
> > > 
> > > no?
> > 
> > I'm using the array so I can search for a prefix that is somewhere in the  
> > phrase. I can use "spir" as text to get the title.  
> > I've tried a standard analyzer on the suggest field, but it's not  
> > allowing that kind of search
> > 
> > > But it's probably not what the completion suggest was meant for.
> > > 
> > > > > I don't if I understand the usecase here. what would you expecte as  
> > > > > the output here?
> > > > 
> > > > Let's say I have two documents, the first one
> > > > 
> > > > "input": ["smells", "like", "teen", "spirit"]
> > > > 
> > > > "output": "Smells like teen spirit"
> > > > 
> > > > and the second one
> > > > 
> > > > "input": ["smells", "like", "children"]
> > > > 
> > > > "output": "Smells like children"
> > > > 
> > > > I'd like to search with more than one prefix at once. Searching for  
> > > > "smel" and "spir" together should return "Smells like teen spirit"
> > > 
> > > see, this is what I want to understand... what is the usecase that you  
> > > need to do that? who would type two prefixes?  
> > > I don't want to say that this is wrong I just wanna understand it to  
> > > give you better advice... I'd expect that you get one prefix that could be  
> > > somewhere in the phrase but that is a different problem with different  
> > > solutions.
> > 
> > It would be an the ability for a user to narrow the search results while  
> > typing, but using any word in the phrase he's looking for.  
> > The first word would probably be a complete term, not a prefix, when he  
> > starts typing the second term.  
> > For the titles example, it would be someone that starts looking for  
> > "smells" and after getting the results, he starts typing "chil" for  
> > example, to narrow the results.
> > 
> > What would be the best approach to this kind of use case?  
> > And what would be the best way to get a prefix somewhere in the phrase?
> 
> ok so you wanna display results while the person is typing? I guess a  
> edgeNGram approach would be the best for this. I still don't see why I'd  
> type "chil" after "smells" if you already display me "smells like children"  
> as a query so I can just select it and fire the search. This service is  
> more of a query suggestion like you get in google when you start typing.
> 
> simon
> 
> > Thanks
> > 
> > > It the title is a string field indexed with a standard analyzer it is  
> > > possible to use a prefix filter for each of the search terms and combine  
> > > them with an and filter.  
> > > Is there a way to obtain a similar thing with the completion suggest?
> > 
> > > Thanks
> > > 
> > > On Wednesday, 21 August 2013 13:28:22 UTC+1, simonw wrote:
> > > 
> > > > > > so you want us to expand all the term in you query? I think you  
> > > > > > should send multiple prefix requests instead one with "nir" one with "nev".  
> > > > > > I really can't entirely figure out when you would have a need for  
> > > > > > something like this to be honest. can you provide a usecase that migh tmake  
> > > > > > it easier to help you.
> > > > > > 
> > > > > > simon
> > > > > > 
> > > > > > On Wednesday, August 21, 2013 12:16:23 PM UTC+2, wron...@gmail.comwrote:
> > > > > > 
> > > > > > > Hello Everyone,
> > > > > > > 
> > > > > > > I'm new to elasticsearch and I'm doing some experiments with the  
> > > > > > > completion suggest feature.  
> > > > > > > I was wondering if using a string array as 'input' parameter when  
> > > > > > > indexing, as in the example on the guide
> > > > > > > 
> > > > > > > "input": ["Nevermind", "Nirvana"]
> > > > > > > 
> > > > > > > is there anyway to use multiple prefixes in the suggest query?  
> > > > > > > Something like:
> > > > > > > 
> > > > > > > {  
> > > > > > > "song-suggest" : {  
> > > > > > > "text" : "nev nir",  
> > > > > > > "completion" : {  
> > > > > > > "field" : "suggest"  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }
> > > > > > > 
> > > > > > > Or is there any mapping for the completion type that would allow a  
> > > > > > > similar suggest query?
> > > > > > > 
> > > > > > > Thanks for any help
> > > > > > > 
> > > > > > > --  
> > > > > > > You received this message because you are subscribed to a topic in the  
> > > > > > > Google Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/\*\*to](https://groups.google.com/d/**to)\*  
> > > > > > > \*pic/elasticsearch/\*\*9xUcyVIBS3U/\*\*unsubscribe[https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe](https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe)  
> > > > > > > .  
> > > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > > elasticsearc...@\*\*googlegroups.\*\*com.
> > > > 
> > > > For more options, visit [https://groups.google.com/\*\*grou\*\*ps/opt\_out](https://groups.google.com/ **grou** ps/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > .
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)\*\*  
> > > topic/elasticsearch/\*\*9xUcyVIBS3U/unsubscribe[https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe](https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe)  
> > > .  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).  
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe](https://groups.google.com/d/topic/elasticsearch/9xUcyVIBS3U/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:20am UTC](https://discuss.elastic.co/t/completion-suggest-question/13283/10 "2017-07-06T02:20:00Z")

</div>


