# Carrying out queries through an specific analyzer

**URL:** <https://discuss.elastic.co/t/carrying-out-queries-through-an-specific-analyzer/3832>\
**Category:** Elasticsearch\
**Created:** [January 27, 2011, 3:30am UTC](https://discuss.elastic.co/t/carrying-out-queries-through-an-specific-analyzer/3832 "2011-01-27T03:30:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Algoncalves](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Algoncalves](https://discuss.elastic.co/u/Algoncalves)\
**Post date:** [January 27, 2011, 3:30am UTC](https://discuss.elastic.co/t/carrying-out-queries-through-an-specific-analyzer/3832/1 "2011-01-27T03:30:53Z")

</div>

Hi All,

I´m trying to search using my own analyzer which was configured into elasticsearch.yml. The index mapping is declared below and it is working quite well.

```
private String fileAsString = "{"
	+ "\"tweet\" : {"
	+ " \"properties\" : {"
	+ " \"user\" : { \"type\" : \"string\", \"index\" : \"analyzed\", \"store\" : \"yes\"},"
	+ " \"message\" : { \"type\" : \"string\", \"index\" : \"analyzed\", \"store\" : \"yes\", \"analyzer\" : \"my_analyzer\", \"term_vector\" : \"with_positions_offsets\"}"
	+ "}}}";

```

However I did not find a way to carry out a query using JAVA API based on the new analyzer. Is there a way to do this?

Regards,

Alex

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [January 28, 2011, 8:19pm UTC](https://discuss.elastic.co/t/carrying-out-queries-through-an-specific-analyzer/3832/2 "2011-01-28T20:19:29Z")

</div>

Hi,

if you search on a "message" field the "my\_analyzer" is not used?

Also I can see that query builders has a method to set analyzer, for  
example:  
[https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryStringQueryBuilder.java#L152](https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryStringQueryBuilder.java#L152)

Regards,  
Lukas

On Thu, Jan 27, 2011 at 4:30 AM, Algoncalves \<  
[alexandre.l.goncalves@gmail.com](mailto:alexandre.l.goncalves@gmail.com)\> wrote:

> Hi All,
> 
> I´m trying to search using my own analyzer which was configured into  
> elasticsearch.yml. The index mapping is declared below and it is working  
> quite well.
> 
> ```
> private String fileAsString = "{"
> + "\"tweet\" : {"
> + " \"properties\" : {"
> + " \"user\" : { \"type\" : \"string\", \"index\" :
> 
> ```
> 
> "analyzed",  
> "store" : "yes"},"  
> + " "message" : { "type" : "string", "index"  
> :  
> "analyzed", "store" : "yes", "analyzer" : "my\_analyzer",  
> "term\_vector" : "with\_positions\_offsets"}"  
> + "}}}";
> 
> However I did not find a way to carry out a query using JAVA API based on  
> the new analyzer. Is there a way to do this?
> 
> Regards,
> 
> ## Alex
> 
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Carrying-out-queries-through-an-specific-analyzer-tp2359690p2359690.html](http://elasticsearch-users.115913.n3.nabble.com/Carrying-out-queries-through-an-specific-analyzer-tp2359690p2359690.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![Algoncalves](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Algoncalves](https://discuss.elastic.co/u/Algoncalves)\
**Post date:** [March 18, 2011, 12:38pm UTC](https://discuss.elastic.co/t/carrying-out-queries-through-an-specific-analyzer/3832/3 "2011-03-18T12:38:05Z")

</div>

Lukas,

Thanks for your help. It´s worked quite well.

Regards,

Alex

---

<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:09am UTC](https://discuss.elastic.co/t/carrying-out-queries-through-an-specific-analyzer/3832/4 "2017-07-06T04:09:42Z")

</div>


