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


(Ivan Ji) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #2

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 :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 9 avr. 2014 à 04:54, Ivan Ji 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.com.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/E9B269EA-A65D-4153-9F3F-82FECAD29574%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.


(Ivan Ji) #3

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 :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 9 avr. 2014 à 04:54, Ivan Ji <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 <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/2fdb749e-745b-40b5-965f-f6b82a1e4f7f%40googlegroups.comhttps://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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b551dfed-05f2-4ce5-855f-a7625fbd0fac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4