0

エラスティック サーチで、1 つの multi_field タイプを使用してインデックスに次のマッピングを定義しました。

{
    'station': {
       "properties" :{
           'id': {'type': 'integer'},
           'call': {'type': 'multi_field', 
                    'fields' : {
                               'call': {'type': 'string', 'analyzer': 'whitespace'},
                               'raw': {'type': 'string', 'index': 'not_analyzed'}
                               }
                    }
        }
    }
}

Mozilla の ElasticUltis が気に入っていますが、multi_field フィールドを照会する方法が見つかりませんでした。

私は次のようなものを期待していたでしょう:

myQuery = S.query(call_raw__wildcard="value")

Elasticutils で multi_field フィールドをクエリする方法を知っている人はいますか?

4

2 に答える 2

0

わかりました - multi_fieldドキュメント (tnx @DrTech) で回避策を見つけました。"path":"just_name" を追加すると、"call" プレフィックスなしでフィールド (質問の "call.raw") にアクセスできます。次に、マッピングは次のようになります。

{
'station': {
   "properties" :{
       'id': {'type': 'integer'},
       'call': {'type': 'multi_field', 
                'path' : 'just_name',
                'fields' : {
                           'call': {'type': 'string', 'analyzer': 'whitespace'},
                           'raw': {'type': 'string', 'index': 'not_analyzed'}
                           }
                }
    }
}

}

残念ながら、これは単なる回避策です。多分他の誰かがより良い考えを持っていますか?

于 2014-02-03T13:59:47.670 に答える