# TextQueryBuilder error

**URL:** <https://discuss.elastic.co/t/textquerybuilder-error/4718>\
**Category:** Elasticsearch\
**Created:** [June 27, 2011, 5:47pm UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718 "2011-06-27T17:47:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [June 27, 2011, 5:47pm UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718/1 "2011-06-27T17:47:41Z")

</div>

Hi,

I'm receiving this error:

```
    [contactindex_2011_06_22_16_54_43] No text specified for text

```

query

When building this query:

```
   TextQueryBuilder textQuery = new TextQueryBuilder("fullName",

```

"Jones");  
textQuery.type(TextQueryBuilder.Type.PHRASE\_PREFIX);

And building in a standard fashion:

```
	SearchRequestBuilder searchReq = client.prepareSearch()
		//.addFields(DEFAULT_FIELDS)
		.setIndices(indexes)
		.setTypes(types)
		.setQuery(textQuery)
		.setFrom(this.start)
		.setSize(pageSize);

```

Any ideas why this is happening?

Also, I would like to use MultiPhrasePrefixQuery directly, but it  
appears that I have to use TextQueryBuilder as an intermediary, is  
that true?

Best Regards,

David.

---

<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:** [June 27, 2011, 5:50pm UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718/2 "2011-06-27T17:50:13Z")

</div>

Which version are you using?

On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:

> Hi,
> 
> I'm receiving this error:
> 
> [contactindex\_2011\_06\_22\_16\_54\_43] No text specified for text  
> query
> 
> When building this query:
> 
> TextQueryBuilder textQuery = new TextQueryBuilder("fullName",  
> "Jones");  
> textQuery.type(TextQueryBuilder.Type.PHRASE\_PREFIX);
> 
> And building in a standard fashion:
> 
> SearchRequestBuilder searchReq = client.prepareSearch()  
> //.addFields(DEFAULT\_FIELDS)  
> .setIndices(indexes)  
> .setTypes(types)  
> .setQuery(textQuery)  
> .setFrom(this.start)  
> .setSize(pageSize);
> 
> Any ideas why this is happening?
> 
> Also, I would like to use MultiPhrasePrefixQuery directly, but it  
> appears that I have to use TextQueryBuilder as an intermediary, is  
> that true?
> 
> Best Regards,
> 
> David.

---

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [June 28, 2011, 8:33am UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718/3 "2011-06-28T08:33:42Z")

</div>

Hi Shay,

I'm Using 0.16.1.

On Jun 27, 6:50 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Which version are you using?
> 
> On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:
> 
> > Hi,
> 
> > I'm receiving this error:
> 
> > [contactindex\_2011\_06\_22\_16\_54\_43] No text specified for text  
> > query
> 
> > When building this query:
> 
> > TextQueryBuilder textQuery = new TextQueryBuilder("fullName",  
> > "Jones");  
> > textQuery.type(TextQueryBuilder.Type.PHRASE\_PREFIX);
> 
> > And building in a standard fashion:
> 
> > SearchRequestBuilder searchReq = client.prepareSearch()  
> > //.addFields(DEFAULT\_FIELDS)  
> > .setIndices(indexes)  
> > .setTypes(types)  
> > .setQuery(textQuery)  
> > .setFrom(this.start)  
> > .setSize(pageSize);
> 
> > Any ideas why this is happening?
> 
> > Also, I would like to use MultiPhrasePrefixQuery directly, but it  
> > appears that I have to use TextQueryBuilder as an intermediary, is  
> > that true?
> 
> > Best Regards,
> 
> > David.

---

<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:** [June 28, 2011, 8:42am UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718/4 "2011-06-28T08:42:00Z")

</div>

Use 0.16.2, it should be fixed.

On Tuesday, June 28, 2011 at 11:33 AM, davrob2 wrote:

> Hi Shay,
> 
> I'm Using 0.16.1.
> 
> On Jun 27, 6:50 pm, Shay Banon \<[shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) ([http://elasticsearch.com](http://elasticsearch.com))\> wrote:
> 
> > Which version are you using?
> > 
> > On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:
> > 
> > > Hi,
> > 
> > > I'm receiving this error:
> > 
> > > [contactindex\_2011\_06\_22\_16\_54\_43] No text specified for text  
> > > query
> > 
> > > When building this query:
> > 
> > > TextQueryBuilder textQuery = new TextQueryBuilder("fullName",  
> > > "Jones");  
> > > textQuery.type(TextQueryBuilder.Type.PHRASE\_PREFIX);
> > 
> > > And building in a standard fashion:
> > 
> > > SearchRequestBuilder searchReq = client.prepareSearch()  
> > > //.addFields(DEFAULT\_FIELDS)  
> > > .setIndices(indexes)  
> > > .setTypes(types)  
> > > .setQuery(textQuery)  
> > > .setFrom(this.start)  
> > > .setSize(pageSize);
> > 
> > > Any ideas why this is happening?
> > 
> > > Also, I would like to use MultiPhrasePrefixQuery directly, but it  
> > > appears that I have to use TextQueryBuilder as an intermediary, is  
> > > that true?
> > 
> > > Best Regards,
> > 
> > > David.

---

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [June 28, 2011, 3:21pm UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718/5 "2011-06-28T15:21:00Z")

</div>

Yes, the upgrade did the trick. thanks.

On Jun 28, 9:42 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Use 0.16.2, it should be fixed.
> 
> On Tuesday, June 28, 2011 at 11:33 AM, davrob2 wrote:
> 
> > Hi Shay,
> 
> > I'm Using 0.16.1.
> 
> > On Jun 27, 6:50 pm, Shay Banon \<[shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) ([http://elasticsearch.com](http://elasticsearch.com))\> wrote:
> > 
> > > Which version are you using?
> 
> > > On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:
> > > 
> > > > Hi,
> 
> > > > I'm receiving this error:
> 
> > > > [contactindex\_2011\_06\_22\_16\_54\_43] No text specified for text  
> > > > query
> 
> > > > When building this query:
> 
> > > > TextQueryBuilder textQuery = new TextQueryBuilder("fullName",  
> > > > "Jones");  
> > > > textQuery.type(TextQueryBuilder.Type.PHRASE\_PREFIX);
> 
> > > > And building in a standard fashion:
> 
> > > > SearchRequestBuilder searchReq = client.prepareSearch()  
> > > > //.addFields(DEFAULT\_FIELDS)  
> > > > .setIndices(indexes)  
> > > > .setTypes(types)  
> > > > .setQuery(textQuery)  
> > > > .setFrom(this.start)  
> > > > .setSize(pageSize);
> 
> > > > Any ideas why this is happening?
> 
> > > > Also, I would like to use MultiPhrasePrefixQuery directly, but it  
> > > > appears that I have to use TextQueryBuilder as an intermediary, is  
> > > > that true?
> 
> > > > Best Regards,
> 
> > > > David.

---

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [June 28, 2011, 4:30pm UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718/6 "2011-06-28T16:30:20Z")

</div>

Is there a way I can use a prefix query against a non-analysed field,  
but get results back that ignore case.

The obvious way of doing this is to index an uppercase version of the  
field and convert all queries to uppercase, is there a way that I can  
do this without creating a new field?

On Jun 28, 4:21 pm, davrob2 [davirobe...@gmail.com](mailto:davirobe...@gmail.com) wrote:

> Yes, the upgrade did the trick. thanks.
> 
> On Jun 28, 9:42 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Use 0.16.2, it should be fixed.
> 
> > On Tuesday, June 28, 2011 at 11:33 AM, davrob2 wrote:
> > 
> > > Hi Shay,
> 
> > > I'm Using 0.16.1.
> 
> > > On Jun 27, 6:50 pm, Shay Banon \<[shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) ([http://elasticsearch.com](http://elasticsearch.com))\> wrote:
> > > 
> > > > Which version are you using?
> 
> > > > On Monday, June 27, 2011 at 8:47 PM, davrob2 wrote:
> > > > 
> > > > > Hi,
> 
> > > > > I'm receiving this error:
> 
> > > > > [contactindex\_2011\_06\_22\_16\_54\_43] No text specified for text  
> > > > > query
> 
> > > > > When building this query:
> 
> > > > > TextQueryBuilder textQuery = new TextQueryBuilder("fullName",  
> > > > > "Jones");  
> > > > > textQuery.type(TextQueryBuilder.Type.PHRASE\_PREFIX);
> 
> > > > > And building in a standard fashion:
> 
> > > > > SearchRequestBuilder searchReq = client.prepareSearch()  
> > > > > //.addFields(DEFAULT\_FIELDS)  
> > > > > .setIndices(indexes)  
> > > > > .setTypes(types)  
> > > > > .setQuery(textQuery)  
> > > > > .setFrom(this.start)  
> > > > > .setSize(pageSize);
> 
> > > > > Any ideas why this is happening?
> 
> > > > > Also, I would like to use MultiPhrasePrefixQuery directly, but it  
> > > > > appears that I have to use TextQueryBuilder as an intermediary, is  
> > > > > that true?
> 
> > > > > Best Regards,
> 
> > > > > David.

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [June 28, 2011, 4:42pm UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718/7 "2011-06-28T16:42:42Z")

</div>

Hi David

On Tue, 2011-06-28 at 09:30 -0700, davrob2 wrote:

> Is there a way I can use a prefix query against a non-analysed field,  
> but get results back that ignore case.

Not\_analyzed fields are ... not analyzed 🙂 So whatever you put in  
there is what is stored. ES can only find terms that actually exist, so  
no, you can't have a case-insensitive prefix query on a not\_analyzed  
field.

> The obvious way of doing this is to index an uppercase version of the  
> field and convert all queries to uppercase, is there a way that I can  
> do this without creating a new field?

Two choices here:

1. Does your field actually need to be not\_analyzed? You could instead  
set it to use a custom analyzer with the keyword tokenizer  
and the lower-case token filter.

2. Alternatively, if you need to keep the field value in the original  
case, you could use multi-fields, with the 'main' version  
not\_analyzed and another version analyzed as described in (1)

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

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

clint

---

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [June 29, 2011, 12:12pm UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718/8 "2011-06-29T12:12:23Z")

</div>

Hi Clint,

yes, I thought that must be the case, but I might as well ask. Thanks  
for the suggestion in 2), I will look at how that works.

David

On Jun 28, 5:42 pm, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:

> Hi David
> 
> On Tue, 2011-06-28 at 09:30 -0700, davrob2 wrote:
> 
> > Is there a way I can use a prefix query against a non-analysed field,  
> > but get results back that ignore case.
> 
> Not\_analyzed fields are ... not analyzed 🙂 So whatever you put in  
> there is what is stored. ES can only find terms that actually exist, so  
> no, you can't have a case-insensitive prefix query on a not\_analyzed  
> field.
> 
> > The obvious way of doing this is to index an uppercase version of the  
> > field and convert all queries to uppercase, is there a way that I can  
> > do this without creating a new field?
> 
> Two choices here:
> 
> 1. Does your field actually need to be not\_analyzed? You could instead  
> set it to use a custom analyzer with the keyword tokenizer  
> and the lower-case token filter.
> 
> 2. Alternatively, if you need to keep the field value in the original  
> case, you could use multi-fields, with the 'main' version  
> not\_analyzed and another version analyzed as described in (1)
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/k...http://www.elasticsearch.org/guide/reference/index-modules/analysis/l...http://www.elasticsearch.org/guide/reference/mapping/multi-field-type)...
> 
> clint

---

<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, 4:02am UTC](https://discuss.elastic.co/t/textquerybuilder-error/4718/9 "2017-07-06T04:02:16Z")

</div>


