# How to extend TermQuery to ''\_all" field

**URL:** <https://discuss.elastic.co/t/how-to-extend-termquery-to--all-field/20195>\
**Category:** Elasticsearch\
**Created:** [October 11, 2014, 2:15am UTC](https://discuss.elastic.co/t/how-to-extend-termquery-to--all-field/20195 "2014-10-11T02:15:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiehaiwei](https://avatars.discourse-cdn.com/v4/letter/x/6de8d8/32.png) [@xiehaiwei](https://discuss.elastic.co/u/xiehaiwei)\
**Post date:** [October 11, 2014, 2:15am UTC](https://discuss.elastic.co/t/how-to-extend-termquery-to--all-field/20195/1 "2014-10-11T02:15:03Z")

</div>

hi all,

```
 In my case, fields are too much, I want use "_all" to simplify query 

```

parameters.  
As term query dsl, I want use like this, how to implement it?

"term" : { "\_all" : "kimchy" }

Thanks.  
Haiwei

--  
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/314eb7f6-cf20-4d93-b436-6938d92f3fa9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/314eb7f6-cf20-4d93-b436-6938d92f3fa9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![xiehaiwei](https://avatars.discourse-cdn.com/v4/letter/x/6de8d8/32.png) [@xiehaiwei](https://discuss.elastic.co/u/xiehaiwei)\
**Post date:** [October 11, 2014, 12:21pm UTC](https://discuss.elastic.co/t/how-to-extend-termquery-to--all-field/20195/2 "2014-10-11T12:21:24Z")

</div>

Hi,

```
The copy_to parameter can work in my case.  

```

Thanks

====================mails from lucene mail list=================

> ```
> 'Internally this is indexing every field a second time into the 
> 
> ```

"\_all" field.'

> This sentence mean second indexing has total different analyzer and  
> indexing compared with my first indexing?

Exactly.

> So I need rewrite the second  
> process to fix my problem?

In Elasticsearch you can define the analyzer for the "\_all" field. It is  
just configureable through the mapping like any other field.

But you should ask those questions on the Elasticsearch mailing list.

> > Hi,
> > 
> > by default there is no "\_all" field. E.g., Elasticsearch adds this  
> > special field  
> > depending on your index mapping at the time of indexing the data.  
> > Internally  
> > this is indexing every field a second time into the "\_all" field.
> > 
> > With Lucene you have to do this on yourself. An alternative would be to  
> > use another query parser (like the SimpleQueryParser, see  
> > [SimpleQueryParser (Lucene 4.10.1 API)](http://goo.gl/4blGsp)) that allows to expand the query to search on  
> > multiple  
> > fields with different weight factors.
> > 
> > Uwe
> > 
> > * * *
> > 
> > Uwe Schindler  
> > H.-H.-Meier-Allee 63, D-28213 Bremen  
> > [http://www.thetaphi.de](http://www.thetaphi.de)  
> > eMail: [uwe@thetaphi.de](mailto:uwe@thetaphi.de)

You should ask this on the elasticsearch mailing list.

BTW, look at elasticsearch copy\_to feature. Better than \_all field.

My 2 cents.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 11 oct. 2014 à 11:31, "haiwei.xie-soulinfo" [haiwei.xie@soulinfo.com](mailto:haiwei.xie@soulinfo.com)  
> a écrit :
> 
> Hi,
> 
> ```
> Thanks for your advise, SimpleQueryParser api is not enough in my 
> 
> ```

case.

> Actually, I want to index data from database, there are so many fields, I  
> have  
> tested "\_all" parameter in Elasticsearch system, but the result of '\_all'  
> and 'fieldname' are different for chinese term.
> 
> ```
> 'Internally this is indexing every field a second time into the 
> 
> ```

"\_all" field.'

> This sentence mean second indexing has total different analyzer and  
> indexing compared  
> with my first indexing? So I need rewrite the second process to fix my  
> problem?
> 
> Thanks.
> 
> Haiwei

--  
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/8a342b81-2ee7-45a5-a92c-3c0532d9c2b8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8a342b81-2ee7-45a5-a92c-3c0532d9c2b8%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:56am UTC](https://discuss.elastic.co/t/how-to-extend-termquery-to--all-field/20195/3 "2017-07-06T00:56:46Z")

</div>


