0
2つのクエリがあります。結果は正確なテキストマッチ戻ると用語配列を使用した弾性検索照合クエリで部分一致ヒットが返されない
- クエリAが部分テキスト一致戻ると
- クエリAは、正確なテキストマッチ戻ると
- クエリBは、部分テキストと
- クエリBに当たる当たる当たるようなものですヒット
なぜクエリBは、部分的にテキストでヒットを返さないを返さないのですか?私の期待は、{"match": {"_all": "PARTIAL_OR_COMPLETE_TEXT_HERE"}
がすべての4つのケースで一致するということです。私が知ることのできる唯一の違いは、動作していないクエリではが使用されていますが、動作中のクエリでは
が役に立ちます。ありがとう。ここで
クエリA
{
"size": 10000,
"query": {
"bool": {
"must": [
{
"match": {
"_all": "RSTCPLS-1F56E8B836"
}
},
{
"term": {
"merchant_id": 10012
}
},
{
"term": {
"sb_status": "open"
}
},
{
"term": {
"has_unfulfilled_quantity": "true"
}
},
{
"term": {
"sb_payment_status": "all"
}
}
],
"must_not": [],
"should": [],
"filter": [
{
"range": {
"ordered_at": {
"gte": "1992-04-01T17:01:39Z",
"lte": "2017-05-01T10:01:39-07:00"
}
}
},
{
"term": {
"is_archived": "false"
}
}
]
}
}
}
クエリB
{
"size": 10000,
"query": {
"bool": {
"must": [
{
"match": {
"_all": "test123"
}
},
{
"term": {
"merchant_id": 10012
}
},
{
"terms": {
"sb_status": [
"open,",
"completed"
]
}
},
{
"terms": {
"last_shipment_state": [
"created",
"submitted",
"processing"
]
}
},
{
"term": {
"sb_payment_status": "all"
}
}
],
"must_not": [],
"should": [],
"filter": [
{
"range": {
"ordered_at": {
"gte": "1992-04-01T17:03:12Z",
"lte": "2017-05-01T10:03:12-07:00"
}
}
},
{
"term": {
"is_archived": "false"
}
}
]
}
}
}
UPDATE
は私のネストされたフィールドを対象に、より直接的なクエリです。私はこのクエリのヒットを取得しますが、nested_items.sku
から1文字を削除するとヒットしません。ここで
{
"size": 10000,
"query": {
"bool": {
"must": [
{
"nested": {
"path": "nested_items",
"query": {
"bool": {
"must": [
{
"match": {
"nested_items.sku": "RSTCPLS-1F56E8B836"
}
}
]
}
}
}
}
]
}
}
}
は私のマッピング
{"orders_development_20170403084520375"=>
{"mappings"=>
{"order"=>
{"_all"=>{"analyzer"=>"searchkick_index"},
"dynamic_templates"=>
[{"string_template"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"fields"=>{"analyzed"=>{"index"=>"analyzed", "type"=>"text"}}, "ignore_above"=>1024, "include_in_all"=>true, "type"=>"keyword"}}}],
"properties"=>
{"billing"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"billing_contact"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"billing_email"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"channel_id"=>{"type"=>"long"},
"created_at"=>{"type"=>"date"},
"display_ref"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"has_unfulfilled_quantity"=>{"type"=>"boolean"},
"is_archived"=>{"type"=>"boolean"},
"item_names"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"last_shipment_state"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text"}}, "include_in_all"=>true, "ignore_above"=>1024},
"merchant_id"=>{"type"=>"long"},
"nested_items"=>
{"type"=>"nested",
"properties"=>
{"extended_total_in_cents"=>{"type"=>"long"},
"name"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text"}}, "include_in_all"=>true, "ignore_above"=>1024},
"quantity"=>{"type"=>"long"},
"quantity_fulfilled"=>{"type"=>"long"},
"sku"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text"}}, "include_in_all"=>true, "ignore_above"=>1024}}},
"order_ref"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"ordered_at"=>{"type"=>"date"},
"sb_order_seq"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text"}}, "include_in_all"=>true, "ignore_above"=>1024},
"sb_payment_status"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text"}}, "include_in_all"=>true, "ignore_above"=>1024},
"sb_status"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text"}}, "include_in_all"=>true, "ignore_above"=>1024},
"shipping_contact"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"shipping_email"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"skus"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"status"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text"}}, "include_in_all"=>true, "ignore_above"=>1024},
"total_in_cents"=>{"type"=>"long"},
"updated_at"=>{"type"=>"date"},
"warehouse_ids"=>{"type"=>"long"}}},
"_default_"=>
{"_all"=>{"analyzer"=>"searchkick_index"},
"dynamic_templates"=>
[{"string_template"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"fields"=>{"analyzed"=>{"index"=>"analyzed", "type"=>"text"}}, "ignore_above"=>1024, "include_in_all"=>true, "type"=>"keyword"}}}],
"properties"=>
{"billing"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"billing_contact"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"billing_email"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"display_ref"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"item_names"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"order_ref"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"shipping_contact"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"shipping_email"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024},
"skus"=>{"type"=>"keyword", "fields"=>{"analyzed"=>{"type"=>"text", "analyzer"=>"searchkick_index"}, "word_middle"=>{"type"=>"text", "analyzer"=>"searchkick_word_middle_index"}}, "ignore_above"=>1024}}}}}}
あなたはタイプミスをしましたか?#line19: '' open、 "、'(引用の前のコンマ、引用の後のコンマ)?また、愚かな質問 - あなたは*クエリB *のような基準を満たす文書を持っていると確信していますか? –
ああ、コンマを見つけてくれてありがとう。それは結果に影響を与えなかったことが分かります。私はそれを検索用語そのものに絞り込んだ。 "12345"と "singleword"は、ネストされたフィールドに部分一致を生成しません。しかし、 "複数の単語"と "ABC-123-DEF-456"は、ネストされたフィールドの部分テキスト一致でヒットを検出します。私のマッピングと、ネストされたフィールドが正しく分析されるようにする方法を検討しています。 – cheeseandpepper
あなたのインデックスマッピングを共有する価値があると思います:)そして、愚かな質問を申し訳ありません - ここではネストされたフィールドを使用しているとは思わない - 上記のクエリでどこで使用するのか詳しく教えてください。 –