2016-04-14 9 views
1

私はElastic Searchについて何かを理解しようとしています。私はElastic Searchを完全に理解しているとは思わない

私が持っている問題は、どれくらいのインデックスを維持し、あまりにも多くのインデックスでリスクがあるかということです。

  • 著者
  • 章名
  • ブック名
  • 出版社

私はそれを理解して見るように:私は、ライブラリ内のインデックスブックにしたいと検索できるようにしたいとしましょうESは、正規化されたRDMS構造ではなくデータ型が格納されることを意味するドキュメントストレージエンジンです。私が持っている合併症は、私は1つのデータ型を作成し、それを格納するか、他のものを作成する必要がありますか?

は、どのように私は次の組み合わせ検索できるようにデータを格納します:出版社のXによって

  1. すべての著者を
  2. Y
  3. すべてのBとし、出版社によって始め帳の名前のすべての章の名前著者名で書かれた書籍の書籍名Y

各章にインデックスが作成されているかどうかは、それぞれの章でその本を特集します。

これをもっと複雑にしていますか?

答えて

4

あなたの質問には、インデックス(MySQLではデータベースアナログ)を作成する必要があります。このインデックス内では、コンテンツタイプ(MySQLのテーブルなど)を使用する必要があり、各書籍は内部のドキュメントになりますデータ型あなたはどのフィールド

POST library/books/_search 
{ 
    "query": { 
    "term": { 
     "language": { 
     "value": "english" 
     } 
    } 
    } 
} 

またはいずれかのフィールドで文書を検索することができ、この

POST library/books/ISBN-10:1449358543 
{ 
    "type": "Paperback", 
    "pages": 724, 
    "Publisher": "O'Reilly Media; 1 edition (Feb. 7 2015)", 
    "language": "English", 
    "tag": "Elasticsearch: The Definitive Guide Paperback – Feb 7 2015\nby Clinton Gormley (Author), Zachary Tong (Author)", 
    "desc": "Whether you need full-text search or real-time analytics of structured data—or both—the Elasticsearch distributed search engine is an ideal way to put your data to work. This practical guide not only shows you how to search, analyze, and explore data with Elasticsearch, but also helps you deal with the complexities of human language, geolocation, and relationships.\nIf you’re a newcomer to both search and distributed systems, you’ll quickly learn how to integrate Elasticsearch into your application. More experienced users will pick up lots of advanced techniques. Throughout the book, you’ll follow a problem-based approach to learn why, when, and how to use Elasticsearch features.\nUnderstand how Elasticsearch interprets data in your documents Index and query your data to take advantage of search concepts such as relevance and word proximity Handle human language through the effective use of analyzers and queries Summarize and group data to show overall trends, with aggregations and analytics Use geo-points and geo-shapes—Elasticsearch’s approaches to geolocation Model your data to take advantage of Elasticsearch’s horizontal scalability Learn how to configure and monitor your cluster in production" 
} 

のようにあなたの本を追加することができます

(MySQLでの行など)combinatイオン

POST library/books/_search 
{ 
    "query": { 
    "bool": { 
     "should": [ 
     {"term": { 
      "language": { 
      "value": "english" 
      } 
     }}, 
     {"term": { 
      "type": { 
      "value": "paperback" 
      } 
     }} 
     ] 
    } 
    } 
} 
関連する問題