Terms filter on analyzed field


(Lifo888) #1

Hi,

I'm trying to under how terms filter works with analyzed fields. I have a language field that uses a custom analyzer that coverts the text to lowercase and tokenize the string based on comma. So when indexing doc with language=EN,KO,ZH, i see that ES generates en, ko and zh as the token, and i confirmed that using the _analyze API.

analyze API result:
{
"tokens" : [ {
"token" : "en",
"start_offset" : 0,
"end_offset" : 2,
"type" : "",
"position" : 1
}, {
"token" : "ko",
"start_offset" : 3,
"end_offset" : 5,
"type" : "",
"position" : 2
}, {
"token" : "zh",
"start_offset" : 6,
"end_offset" : 8,
"type" : "",
"position" : 3
} ]
}

... But when i use terms filters to search on the field i get the doc back when i search on "zh", but no result when i search for "ko" or "en". I know terms filters are not analyze but i'm enter the exact token string, so why wouldn't ko or en match?


(system) #2