2011-09-15 14 views
1

これは非常に初心者の質問ですが、私はどのように文書内の特定の要素を増やして を理解しようとしています。elasticsearch boosting slowing query

私はその後、私はもっと他よりも ので、私はこの

{ 
    "from": 0, 
    "size": 60, 
    "fields": [ 
    "_id" 
    ], 
    "sort": { 
    "_score": "desc", 
    "vendor.name.stored": "asc", 
    "item_name.stored": "asc" 
    }, 
    "query": { 
    "filtered": { 
     "query": { 
     "query_string": { 
      "fields": [ 
      "item_name^4", 
      "vendor^4", 
      "id_plus_name", 
      "category_name^3", 
      "targeted_countries", 
      "vendor_search_name^4", 
      "AdditionalProductInformation^0.5", 
      "AskAScientist^0.5", 
      "BuyNowURL^0.5", 
      "Concentration^0.5", 
      "ProductLine^0.5", 
      "Quantity^0.5", 
      "URL^0.5", 
      "Activity^1", 
      "Form^1", 
      "Immunogen^1", 
      "Isotype^1", 
      "Keywords^1", 
      "Matrix^1", 
      "MolecularWeight^1", 
      "PoreSize^1", 
      "Purity^1", 
      "References^1", 
      "RegulatoryStatus^1", 
      "Specifications/Features^1", 
      "Speed^1", 
      "Target/MoleculeDescriptor^1", 
      "Time^1", 
      "Description^2", 
      "Domain/Region/Terminus^2", 
      "Method^2", 
      "NCBIGeneAliases^2", 
      "Primary/Secondary^2", 
      "Source/ExpressionSystem^2", 
      "Target/MoleculeSynonym^2", 
      "Applications^3", 
      "Category^3", 
      "Conjugate/Tag/Label^3", 
      "Detection^3", 
      "GeneName^3", 
      "Host^3", 
      "ModificationType^3", 
      "Modifications^3", 
      "MoleculeName^3", 
      "Reactivity^3", 
      "Species^3", 
      "Target^3", 
      "Type^3", 
      "AccessionNumber^4", 
      "Brand/Trademark^4", 
      "CatalogNumber^4", 
      "Clone^4", 
      "entrezGeneID^4", 
      "GeneSymbol^4", 
      "OriginalItemName^4", 
      "Sequence^4", 
      "SwissProtID^4", 
      "option.AntibodyProducts^4", 
      "option.AntibodyRanges&Modifications^1", 
      "option.Applications^4", 
      "option.Conjugate^3", 
      "option.GeneID^4", 
      "option.HostSpecies^3", 
      "option.Isotype^3", 
      "option.Primary/Secondary^2", 
      "option.Reactivity^4", 
      "option.Search^1", 
      "option.TargetName^1", 
      "option.Type^4" 
      ], 
      "query": "Calprotectin", 
      "default_operator": "AND" 
     } 
     }, 
     "filter": { 
     "and": [ 
      { 
      "query": { 
       "query_string": { 
       "fields": [ 
        "targeted_countries" 
       ], 
       "query": "All US" 
       } 
      } 
      } 
     ] 
     } 
    } 
    } 
} 

クエリは、かなり午前に​​鈍化したドキュメント内の特定の要素を高めるために必要な

{ 
    "from": 0, 
    "size": 6, 
    "fields": [ 
    "_id" 
    ], 
    "sort": { 
    "_score": "desc", 
    "vendor.name.stored": "asc", 
    "item_name.stored": "asc" 
    }, 
    "query": { 
    "filtered": { 
     "query": { 
     "query_string": { 
      "fields": [ 
      "_all" 
      ], 
      "query": "Calprotectin", 
      "default_operator": "AND" 
     } 
     }, 
     "filter": { 
     "and": [ 
      { 
      "query": { 
       "query_string": { 
       "fields": [ 
        "targeted_countries" 
       ], 
       "query": "All US" 
       } 
      } 
      } 
     ] 
     } 
    } 
    } 
} 

、このクエリで開始私はこれを正しくしていますか?スピードアップする方法は ですか?私は現在、ドキュメントのインデックスを作成するときにブースティングを実行していますが、クエリでその方法を使用すると、アプリケーションの実行方法に最適です。どんな助けも大いにありがたいです

答えて

2

クエリ時間増強は、用語に大きな重みを割り当てるために使用されます。恒久的にフィールドを強調したい場合は、index time boostingを使用してください。このブースティングを常に使用したくない場合は、store: "no"を設定して別のマッピングを作成するのが理にかなっています。

+0

ありがとうArtur、私の問題は、重量値が頻繁に変更されるので、変更するたびに手動でマッピングを更新しないようにしようとしています。私はこれになると少し初心者ですので、そこから抜け出す方法はありますか? (例えば、 "item_name":{"_boost": "4"、 "_value": "armenian hamster anti-cd95モノクローナル抗体、pe conjugated、clone jo2"}のようなブースト値をインデックスする) – exHash

+0

ブーストは他のコンポーネント(用語頻度と正規化係数)と組み合わされ、結果はインデックスに格納されるため、AFAIKは再インデックスなしでは変更できません。何が原因でフィールドが変化するか?たぶん彼らはあなたの問題の正しい道具ではありませんか? –

+0

実際、私は、あなたが述べた正確な理由のために、インデックス時間増強よりもクエリ時間を増やすことをお勧めします。また、インデックス時間のブースティングは、フィールド長のノルムの精度を低下させます。あなたのクエリが遅くなった理由は、 '_all'フィールドだけを照会するのではなく、多くの多くのフィールドを照会しているからです。 – DrTech