title: Search queries in microservice architecture
body: <p>Assuming I have a microservice architecture where I have a Book microservice holding all book details and a Author microservice holding all author details, e.g.</p>
  
  <pre><code>Book Service
  GET /     get all books
  GET /id   get book details, including author_ids
  POST /    create new book
  etc.
  
  Author Service
  GET /     get all authors
  GET /id   get author details, including book_ids
  POST /    create new author
  etc.
  </code></pre>
  
  <p>The real services are much more enterprise grade, I just choose Books and Authors with their own data storage option as a easy understandable example. </p>
  
  <p>Assuming, there will be millions of calls to the services and I have to uphold specific availability and throughput of systems. How can I efficiently search for authors where name starts with 'A' and all books written by the authors where book title starts with 'B'?</p>
  
  <p>I see following options, which all are not perfect:</p>
  
  <ol>
  <li><p>I create a search endpoint in Author service, fetch all authors matching the search criteria, follow each book_id and filter for the books. -> This requires a lot of calls on the Book service.</p></li>
  <li><p>Same as 1. but I create a search endpoint in Book service, fetch all books matching the search criteria, follow each author_id and filter for the authors. -> This requires a lot of calls on the Author service. In worst case, same load as in 1.</p></li>
  <li><p>I create a new microservice Search. Search will have its own database which is optimized for searches. Search will return me the books and authors and can give me the search result with one call. -> This requires Search to frequently sync with Book and Author service.</p></li>
  <li><p>I merge Book and Author into one service which defeats the purpose of mircroservices?</p></li>
  </ol>
  
  <p>Maybe someone with more microservice experience can help me out how to best architect this.</p>