0

次のマッピングでインデックスを作成しました

    PUT http://localhost:9200/test1
   {
    "mappings": {
        "searchText": {
            "properties": {
                "catalogue_product": {
                    "type":"nested",
                    "properties": {
                        "id": {
                            "type": "string",
                             "index":"not_analyzed"
                        },
                        "long_desc": {
                            "type":"nested",
                            "properties": {
                                "translation": {
                                    "type":"nested",
                                    "properties": {
                                        "en-GB": {
                                            "type": "string",
                                            "anlayzer": "snowball"
                                        },
                                        "fr-FR": {
                                            "type": "string",
                                            "anlayzer": "snowball"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

を使用して1つのレコードを入れました

PUT http://localhost:9200/test1/searchText/1
{
    "catalogue_product": {
        "id": "18437",
        "long_desc": {
            "translation": {
                "en-GB": "C120 - circuit breaker - C120H - 4P - 125A - B curve",
                "fr-FR": "Disjoncteur C120H 4P 125A courbe B 15000A"
            }
        }
    }

}

次に、単語を検索すると

ブレーカ

中身

catalogue_product.long_desc.translation.en-GB

追加されたレコードを取得します

POST http://localhost:9200/test1/searchText/_search
{
    "query": {
        "nested": {
            "path": "catalogue_product.long_desc.translation",
            "query": {
                "match": {
                    "catalogue_product.long_desc.translation.en-GB": "breaker"
                }
            }
        }
    }

}

単語を置き換える場合

ブレーカ

ブレーカー

、 en-GB フィールドのマッピングにanalyzer=snowballがあるにもかかわらず、レコードを取得しません


POST http://localhost:9200/test1/searchText/_search
{
    "query": {
        "nested": {
            "path": "catalogue_product.long_desc.translation",
            "query": {
                "match": {
                    "catalogue_product.long_desc.translation.en-GB": "breakers"
                }
            }
        }
    }

}

私はこれで夢中になります。どこが間違っていますか?スノーボールではなく英語としてアナライザーを使用して新しいマッピングを試みましたが、どちらも機能しませんでした:(

4

1 に答える 1

1

おい、それはタイプミスです。そのアナライザーではなく、アナライザー

   PUT http://localhost:9200/test1
   {
    "mappings": {
        "searchText": {
            "properties": {
                "catalogue_product": {
                    "type":"nested",
                    "properties": {
                        "id": {
                            "type": "string",
                             "index":"not_analyzed"
                        },
                        "long_desc": {
                            "type":"nested",
                            "properties": {
                                "translation": {
                                    "type":"nested",
                                    "properties": {
                                        "en-GB": {
                                            "type": "string",
                                            "analyzer": "snowball"
                                        },
                                        "fr-FR": {
                                            "type": "string",
                                            "analyzer": "snowball"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
于 2015-02-20T16:13:52.843 に答える