# Real time search while entering key words

**URL:** <https://discuss.elastic.co/t/real-time-search-while-entering-key-words/6374>\
**Category:** Elasticsearch\
**Created:** [January 13, 2012, 5:10pm UTC](https://discuss.elastic.co/t/real-time-search-while-entering-key-words/6374 "2012-01-13T17:10:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [January 13, 2012, 5:10pm UTC](https://discuss.elastic.co/t/real-time-search-while-entering-key-words/6374/1 "2012-01-13T17:10:34Z")

</div>

Hi ,

Are there any support for real time search like the one google have.  
Not to be confused by the term real time search , what i mean was that  
search results are displayed long before the entire term is typed.

What i am expecting is some optimizations in this area , may be something  
like abandaning a request if another request (which came after ) from same  
source is processed.

Thanks  
Vineeth

---

<div class="post-metadata">

**Author:** ![Alex\_At\_Ikanow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_at_ikanow/32/676_2.png) [@Alex\_At\_Ikanow](https://discuss.elastic.co/u/Alex_At_Ikanow)\
**Post date:** [January 13, 2012, 9:14pm UTC](https://discuss.elastic.co/t/real-time-search-while-entering-key-words/6374/2 "2012-01-13T21:14:53Z")

</div>

There was a similar discussion a few months back (I think the answer  
on the es optimization side was that it wasn't practical, but I won't  
speak for Shay).

What I do for a similar problem, which works completely fine for me,  
is just to throttle at the interface side, with something like:  
1] On keypress (/new word, whatever), check if there are any pending  
requests:  
1A] If not send a request  
1B] If so, save this request (overwriting anything previously saved)  
and return  
2] When a request returns, send out the saved request, if there is one

(Obviously you can play similar games on the rendering side if there's  
a bottleneck there, ie only displaying the results from [2] if there  
are no saved requests that will replace it, unless there has been no  
update to the display for a given period)

This very simple algorithm prevents a build up of "old" requests. If  
the latency is high enough that this doesn't work reasonably well, my  
guess would be that the searches are too slow to be sensibly rendered  
in real-time anyway!

Alex

On Jan 13, 12:10 pm, Vineeth Mohan [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com) wrote:

> Hi ,
> 
> Are there any support for real time search like the one google have.  
> Not to be confused by the term real time search , what i mean was that  
> search results are displayed long before the entire term is typed.
> 
> What i am expecting is some optimizations in this area , may be something  
> like abandaning a request if another request (which came after ) from same  
> source is processed.
> 
> Thanks  
> Vineeth

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [January 14, 2012, 6:57am UTC](https://discuss.elastic.co/t/real-time-search-while-entering-key-words/6374/3 "2012-01-14T06:57:39Z")

</div>

Hello Alex ,

Thank you for your input .  
Between can you point me to the earlier held discussion.

Thanks  
Vineeth

On Sat, Jan 14, 2012 at 2:44 AM, Alex at Ikanow [apiggott@ikanow.com](mailto:apiggott@ikanow.com) wrote:

> There was a similar discussion a few months back (I think the answer  
> on the es optimization side was that it wasn't practical, but I won't  
> speak for Shay).
> 
> What I do for a similar problem, which works completely fine for me,  
> is just to throttle at the interface side, with something like:  
> 1] On keypress (/new word, whatever), check if there are any pending  
> requests:  
> 1A] If not send a request  
> 1B] If so, save this request (overwriting anything previously saved)  
> and return  
> 2] When a request returns, send out the saved request, if there is one
> 
> (Obviously you can play similar games on the rendering side if there's  
> a bottleneck there, ie only displaying the results from [2] if there  
> are no saved requests that will replace it, unless there has been no  
> update to the display for a given period)
> 
> This very simple algorithm prevents a build up of "old" requests. If  
> the latency is high enough that this doesn't work reasonably well, my  
> guess would be that the searches are too slow to be sensibly rendered  
> in real-time anyway!
> 
> Alex
> 
> On Jan 13, 12:10 pm, Vineeth Mohan [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com) wrote:
> 
> > Hi ,
> > 
> > Are there any support for real time search like the one google have.  
> > Not to be confused by the term real time search , what i mean was that  
> > search results are displayed long before the entire term is typed.
> > 
> > What i am expecting is some optimizations in this area , may be something  
> > like abandaning a request if another request (which came after ) from  
> > same  
> > source is processed.
> > 
> > Thanks  
> > Vineeth

---

<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:** [January 14, 2012, 2:39pm UTC](https://discuss.elastic.co/t/real-time-search-while-entering-key-words/6374/4 "2012-01-14T14:39:00Z")

</div>

The size of the data set and type of data also play a role in what you can  
get away with. We built a demo for a for an organization that allowed them  
to search people this way (internal employees). The video is here:

We pushed all the rendering out to the client and we're using ngrams. The  
code for that demo is here:

[https://github.com/diji/cloud9-demos/tree/master/peepfinder](https://github.com/diji/cloud9-demos/tree/master/peepfinder)

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [January 14, 2012, 3:41pm UTC](https://discuss.elastic.co/t/real-time-search-while-entering-key-words/6374/5 "2012-01-14T15:41:06Z")

</div>

Thanks for the peepfinder code.

But then can you tell me where i can find js files like c9api.min.js and  
json2.js.  
I am not able to find those in that repo

Thanks  
Vineeth

On Sat, Jan 14, 2012 at 8:09 PM, egaumer [egaumer@gmail.com](mailto:egaumer@gmail.com) wrote:

> The size of the data set and type of data also play a role in what you can  
> get away with. We built a demo for a for an organization that allowed them  
> to search people this way (internal employees). The video is here:
> 
> [http://youtu.be/yFTdh0ahx90](http://youtu.be/yFTdh0ahx90)
> 
> We pushed all the rendering out to the client and we're using ngrams. The  
> code for that demo is here:
> 
> [https://github.com/diji/cloud9-demos/tree/master/peepfinder](https://github.com/diji/cloud9-demos/tree/master/peepfinder)

---

<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:** [January 14, 2012, 10:39pm UTC](https://discuss.elastic.co/t/real-time-search-while-entering-key-words/6374/6 "2012-01-14T22:39:05Z")

</div>

Those files are not really relevant, they provide a Javascript (builder)  
client to elasticsearch. The docs are here if your interested though.

[http://www.cloud9search.com/docs.html#jsapi](http://www.cloud9search.com/docs.html#jsapi)

You want to look at the mappings and the data files which are part of that  
github repo.

---

<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:42am UTC](https://discuss.elastic.co/t/real-time-search-while-entering-key-words/6374/7 "2017-07-06T03:42:42Z")

</div>


