# What's the search analyzer of the field inside the document that applied \_analyzer?

**URL:** <https://discuss.elastic.co/t/whats-the-search-analyzer-of-the-field-inside-the-document-that-applied--analyzer/16883>\
**Category:** Elasticsearch\
**Created:** [April 9, 2014, 2:54am UTC](https://discuss.elastic.co/t/whats-the-search-analyzer-of-the-field-inside-the-document-that-applied--analyzer/16883 "2014-04-09T02:54:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Ji](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@Ivan\_Ji](https://discuss.elastic.co/u/Ivan_Ji)\
**Post date:** [April 9, 2014, 2:54am UTC](https://discuss.elastic.co/t/whats-the-search-analyzer-of-the-field-inside-the-document-that-applied--analyzer/16883/1 "2014-04-09T02:54:18Z")

</div>

Hi all,

Assume my index mapping is

"mappings": {

> ```
> "main": {
> "_source": {"enabled": true},
> "_analyzer":{"path": "analyzer_name"},
> "properties": {
> "name": { "type": "string", "index": "analyzed"},
> "analyzer_name": { "type": "string", "index": 
> 
> ```
> 
> "no", "include\_in\_all": false}  
> }  
> }  
> }

By setting the "\_analyzer", we know the default index analyzer id decided  
by the value of the "analyzer\_name" field. Therefore, the analyzer of  
"name" field is decided by the "analyzer\_name" field of the same document.

But how about the search analyzer?

Under my test, it seems the search analyzer is not same with the index  
analyzer which is the value of "analyzer\_name" field.  
The search analyzer seems always be standard. It seems it just statically  
find the search analyzer in the mapping and it just cannot find any  
setting, so it just use the standard default analyzer ?  
That's my guess. Is that correct?

But are there any ways to let the search analyzer be the same one of the  
index analyzer that is decided by the "analyzer\_name" field of the same  
document ?

Ideas?

cheers,

Ivan

--  
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/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 9, 2014, 5:30am UTC](https://discuss.elastic.co/t/whats-the-search-analyzer-of-the-field-inside-the-document-that-applied--analyzer/16883/2 "2014-04-09T05:30:13Z")

</div>

I don't think you can do that.

Because index analyzer is applied to each doc and could be different.  
Search analyzer is applied to your query before searching in the inverted index.

What you should do is to run a bool should query using all analyzers you know if you can not detect your user language (or analyzer he'd like).

My 2 cents

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

Le 9 avr. 2014 à 04:54, Ivan Ji [hxuanji@gmail.com](mailto:hxuanji@gmail.com) a écrit :

Hi all,

Assume my index mapping is

> "mappings": {  
> "main": {  
> "\_source": {"enabled": true},  
> "\_analyzer":{"path": "analyzer\_name"},  
> "properties": {  
> "name": { "type": "string", "index": "analyzed"},  
> "analyzer\_name": { "type": "string", "index": "no", "include\_in\_all": false}  
> }  
> }  
> }

By setting the "\_analyzer", we know the default index analyzer id decided by the value of the "analyzer\_name" field. Therefore, the analyzer of "name" field is decided by the "analyzer\_name" field of the same document.

But how about the search analyzer?

Under my test, it seems the search analyzer is not same with the index analyzer which is the value of "analyzer\_name" field.  
The search analyzer seems always be standard. It seems it just statically find the search analyzer in the mapping and it just cannot find any setting, so it just use the standard default analyzer ?  
That's my guess. Is that correct?

But are there any ways to let the search analyzer be the same one of the index analyzer that is decided by the "analyzer\_name" field of the same document ?

Ideas?

cheers,

## Ivan

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/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/E9B269EA-A65D-4153-9F3F-82FECAD29574%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/E9B269EA-A65D-4153-9F3F-82FECAD29574%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan\_Ji](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@Ivan\_Ji](https://discuss.elastic.co/u/Ivan_Ji)\
**Post date:** [April 9, 2014, 6:13am UTC](https://discuss.elastic.co/t/whats-the-search-analyzer-of-the-field-inside-the-document-that-applied--analyzer/16883/3 "2014-04-09T06:13:41Z")

</div>

Thanks David.

I agreed with you.

And about what you said, to use a bool should query, I am more concerned  
its influence on the performance.

cheers,  
Ivan

David Pilato於 2014年4月9日星期三UTC+8下午1時30分13秒寫道：

> I don't think you can do that.
> 
> Because index analyzer is applied to each doc and could be different.  
> Search analyzer is applied to your query before searching in the inverted  
> index.
> 
> What you should do is to run a bool should query using all analyzers you  
> know if you can not detect your user language (or analyzer he'd like).
> 
> My 2 cents
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 9 avr. 2014 à 04:54, Ivan Ji \<[hxu...@gmail.com](mailto:hxu...@gmail.com) \<javascript:\>\> a écrit :
> 
> Hi all,
> 
> Assume my index mapping is
> 
> "mappings": {
> 
> > ```
> > "main": {
> > "_source": {"enabled": true},
> > "_analyzer":{"path": "analyzer_name"},
> > "properties": {
> > "name": { "type": "string", "index": "analyzed"},
> > "analyzer_name": { "type": "string", "index": 
> > 
> > ```
> > 
> > "no", "include\_in\_all": false}  
> > }  
> > }  
> > }
> 
> By setting the "\_analyzer", we know the default index analyzer id decided  
> by the value of the "analyzer\_name" field. Therefore, the analyzer of  
> "name" field is decided by the "analyzer\_name" field of the same document.
> 
> But how about the search analyzer?
> 
> Under my test, it seems the search analyzer is not same with the index  
> analyzer which is the value of "analyzer\_name" field.  
> The search analyzer seems always be standard. It seems it just statically  
> find the search analyzer in the mapping and it just cannot find any  
> setting, so it just use the standard default analyzer ?  
> That's my guess. Is that correct?
> 
> But are there any ways to let the search analyzer be the same one of the  
> index analyzer that is decided by the "analyzer\_name" field of the same  
> document ?
> 
> Ideas?
> 
> cheers,
> 
> Ivan
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/b551dfed-05f2-4ce5-855f-a7625fbd0fac%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b551dfed-05f2-4ce5-855f-a7625fbd0fac%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, 1:37am UTC](https://discuss.elastic.co/t/whats-the-search-analyzer-of-the-field-inside-the-document-that-applied--analyzer/16883/4 "2017-07-06T01:37:27Z")

</div>


