部分一致を提供するためにエッジngramトークナイザを使用しています。 私の文書はissue with edge_ngram tokenizer IN弾性検索
PUT my_index
{
"settings": {
"analysis": {
"analyzer": {
"autocomplete": {
"tokenizer": "autocomplete",
"filter": [
"lowercase"
]
},
"autocomplete_search": {
"tokenizer": "lowercase"
}
},
"tokenizer": {
"autocomplete": {
"type": "edge_ngram",
"min_gram": 2,
"max_gram": 40,
"token_chars": [
"letter",
"digit"
]
}
}
}
},
"mappings": {
"doc": {
"properties": {
"title": {
"type": "string",
"analyzer": "autocomplete",
"search_analyzer": "autocomplete_search"
}
}
}
}
}
PUT my_index/doc/1
{
"title": "Labson Series LTD 2014"
}
PUT my_index/doc/2
{
"title": "Labson PLO LTD 2014A"
}
PUT my_index/doc/3
{
"title": "Labson PLO LTD 2014-I"
}
PUT my_index/doc/4
{
"title": "Labson PLO LTD. 2014-II"
}
次のクエリは私に正しい3つの文書(Labson PLO LTD 2014A
、Labson PLO LTD 2014-I
、Labson PLO LTD. 2014-II
)
GET my_index/_search
{
"query": {
"match": {
"title": {
"query": "labson plo",
"operator": "and"
}
}
}
}
しかし与えますが、次のように私のマッピングがある
Name
Labson series LTD 2014
Labson PLO LTD 2014A
Labson PLO LTD 2014-I
Labson PLO LTD. 2014-II
のように見えます私はLabson PLO 2014A
と入力すると0件の文書が届きます
GET my_index/_search
{
"query": {
"match": {
"title": {
"query": "Labson PLO 2014A",
"operator": "and"
}
}
}
}
私はこれが1文書Labson PLO LTD 2014A
を返すと予想していますが、何らかの理由でトークンの数字のインデックスを作成していないようです。私がここで何かを逃しているかどうか教えてください。