# Max expansion in text queries

**URL:** <https://discuss.elastic.co/t/max-expansion-in-text-queries/6538>\
**Category:** Elasticsearch\
**Created:** [January 30, 2012, 2:45pm UTC](https://discuss.elastic.co/t/max-expansion-in-text-queries/6538 "2012-01-30T14:45:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Reelsen](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Alexander\_Reelsen](https://discuss.elastic.co/u/Alexander_Reelsen)\
**Post date:** [January 30, 2012, 2:45pm UTC](https://discuss.elastic.co/t/max-expansion-in-text-queries/6538/1 "2012-01-30T14:45:30Z")

</div>

Hi there,

I have got a question about the max\_expansions parameter in text  
queries. According to the documentation the parameter only applies for  
text phrase prefix queries and has a different meaning in text queries  
(for fuzziness instead of prefix query expansions).

However the following lines seem to cause different results

QueryBuilders.textQuery("ProductName.query",  
queryString).maxExpansions($arbitraryNumber)  
QueryBuilders.textQuery("ProductName.query", queryString)

We had this accidentally in our code. The first version caused a out  
of memory exception with small memory memory setups (like on our  
development machines where we dont handle big indexes), but seems to  
work on our bigger testing machines. My guess was, that using this  
parameter should not have any effect in a text query without  
specifying fuzziness.  
I guess I am wrong on this one?

--Alexander

---

<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:** [February 1, 2012, 9:33am UTC](https://discuss.elastic.co/t/max-expansion-in-text-queries/6538/2 "2012-02-01T09:33:38Z")

</div>

maxExpansion is not used when using text query (I just double checked it), so its strange. Are you sure its related?

On Monday, January 30, 2012 at 4:45 PM, Alexander Reelsen wrote:

> Hi there,
> 
> I have got a question about the max\_expansions parameter in text  
> queries. According to the documentation the parameter only applies for  
> text phrase prefix queries and has a different meaning in text queries  
> (for fuzziness instead of prefix query expansions).
> 
> However the following lines seem to cause different results
> 
> QueryBuilders.textQuery("ProductName.query",  
> queryString).maxExpansions($arbitraryNumber)  
> QueryBuilders.textQuery("ProductName.query", queryString)
> 
> We had this accidentally in our code. The first version caused a out  
> of memory exception with small memory memory setups (like on our  
> development machines where we dont handle big indexes), but seems to  
> work on our bigger testing machines. My guess was, that using this  
> parameter should not have any effect in a text query without  
> specifying fuzziness.  
> I guess I am wrong on this one?
> 
> --Alexander

---

<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:40am UTC](https://discuss.elastic.co/t/max-expansion-in-text-queries/6538/3 "2017-07-06T03:40:52Z")

</div>


