Found some strange thing with query_string and stemmer/snowball filters, can't understand how does it work and how to fix this, help me, please.
Analyzer and filter:
'analyzer' => [
'stem_en' => [
'tokenizer' => 'standard',
'filter' => [
'stem_en'
]
],
'snow_en' => [
'tokenizer' => 'standard',
'filter' => [
'snow_en'
]
],
],
'filter' => [
'stem_en' => [
'type' => 'stemmer',
'language' => 'english'
],
'snow_en' => [
'type' => 'snowball',
'language' => 'english'
],
]
Field mapping:
'example' => [
'type' => 'text',
'fields' => [
'snow' => [
'type' => 'text',
'analyzer' => 'snow_en'
],
'stem' => [
'type' => 'text',
'analyzer' => 'stem_en'
],
],
]
Query 1:
{
"explain": true,
"query": {
"query_string": {
"fields": ["example.snow", "example.stem],
"query": "walking~"
}
}
}
Result 1:
{
"took": 11,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
Query 2:
{
"explain": true,
"query": {
"query_string": {
"fields": ["example.snow", "example.stem],
"query": "walkin~"
}
}
}
Result 2:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1.5075798,
"hits": [
{
...,
"_explanation": {
"value": 1.5075798,
"description": "max of:",
"details": [
{
"value": 1.5075798,
"description": "weight(example.snow:walk in 0) [PerFieldSimilarity], result of:",
"details": [ ...
}
Why does query parser can't produce correct token "walk" from "walking~" but could do it with "walkin~"?