# Search Time Query Expansion

**URL:** <https://discuss.elastic.co/t/search-time-query-expansion/20472>\
**Category:** Elasticsearch\
**Created:** [October 29, 2014, 2:44am UTC](https://discuss.elastic.co/t/search-time-query-expansion/20472 "2014-10-29T02:44:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yingkai\_Gao](https://avatars.discourse-cdn.com/v4/letter/y/c68b51/32.png) [@Yingkai\_Gao](https://discuss.elastic.co/u/Yingkai_Gao)\
**Post date:** [October 29, 2014, 2:44am UTC](https://discuss.elastic.co/t/search-time-query-expansion/20472/1 "2014-10-29T02:44:37Z")

</div>

I want to implement a classic query expansion (Rocchio method for example) for  
ElasticSearch.

Basically what I need to do is to retrieve the term vectors of the top N  
relevant documents given an original query, extract a list of terms based  
on some criteria, and finally get enriched document results with a expanded  
query. Surely I can do that by searching twice, but is there any better  
solution that I can do it _IN_ the ElasticSearch? Do you have any  
suggestions about where and how I can implement it?

Thanks!

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4f202647-5a2c-4be8-a731-f485589ef7ad%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4f202647-5a2c-4be8-a731-f485589ef7ad%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:53am UTC](https://discuss.elastic.co/t/search-time-query-expansion/20472/2 "2017-07-06T00:53:17Z")

</div>


