title: Query upgrade and cross index search
body: <p>I have this query which was originally written for ES 1.5.</p>
  
  <p>The query has two issues:</p>
  
  <ul>
  <li>No query.filtered anymore. Transform query to use <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html" rel="nofollow noreferrer">bool/must</a></li>
  <li>No <em>type</em> anymore, thus <em>idea.title</em> and <em>challenge.title</em> are actually two different indexes.</li>
  </ul>
  
  <p>How do I run a query cross-index?</p>
  
  <pre><code>{
      "_source": [
          "id",
          "org_id",
          "author_id",
          "idea_id",
          "challenge_id",
          "bulletin_id",
          "comment",
          "title",
          "description",
          "name",
          "created_at"
      ],
      "query": {
          "filtered": {
              "filter": {
                  "and": [
                      {
                          "terms": {
                              "org_id": [
                                  563
                              ]
                          }
                      }
                  ]
              },
              "query": {
                  "bool": {
                      "should": [
                          {
                              "match": {
                                  "idea.title": "test"
                              }
                          },
                          {
                              "match": {
                                  "idea.description": "test"
                              }
                          },
                          {
                              "match": {
                                  "challenge.title": "test"
                              }
                          },
                          {
                              "match": {
                                  "challenge.description": "test"
                              }
                          },
                          {
                              "match": {
                                  "bulletin.title": "test"
                              }
                          },
                          {
                              "match": {
                                  "bulletin.description": "test"
                              }
                          },
                          {
                              "match": {
                                  "comment_idea.comment": "test"
                              }
                          },
                          {
                              "match": {
                                  "comment_challenge.comment": "test"
                              }
                          },
                          {
                              "match": {
                                  "comment_bulletin.comment": "test"
                              }
                          },
                          {
                              "match": {
                                  "files_idea.name": "test"
                              }
                          },
                          {
                              "match": {
                                  "files_idea.content": "test"
                              }
                          },
                          {
                              "match": {
                                  "files_challenge.name": "test"
                              }
                          },
                          {
                              "match": {
                                  "files_challenge.content": "test"
                              }
                          },
                          {
                              "match": {
                                  "files_bulletin.name": "test"
                              }
                          },
                          {
                              "match": {
                                  "files_bulletin.content": "test"
                              }
                          },
                          {
                              "match": {
                                  "groups.name": "test"
                              }
                          },
                          {
                              "match": {
                                  "users.name": "test"
                              }
                          },
                          {
                              "match": {
                                  "tags.name": "test"
                              }
                          }
                      ]
                  }
              }
          }
      },
      "sort": [
          {
              "users.type_priority": {
                  "order": "desc"
              }
          },
          "_score"
      ]
  }
  </code></pre>