Search multiple indexes with filter

Version of ES currently in use: 5.2

I'm trying to create a query, including filters, that runs against two indexes.

Are there any preconditions , e.g. common fields, some kind of link between documents of a different index, in order to get this kind of query done ?

For instance, I have two indexes:

  • 'files' - containing indexed files
  • 'meta' - containing some meta data of a "client/user"

for each document within 'meta' there can be 0..n document within 'files'.
Because of this definition, the ID's do not match. Exemplary, an ID of a meta-document is: '01-1212-0', an ID of a file "belonging" to the mentioned meta-document is: '01-1212-0+1'.

The aim is to create a query that matches e.g. a 'username' within 'meta'-Index, and the query_string query is additionally looking for e.g. "bytes"

the following query (no special query_string, just match_all) gets me some results

{
"size" : 10,
"query" : {
"bool" : {
  "must" : [{
      "match_all" : {
        "boost" : 1.0
      }}],
  "filter" : [{
      "bool" : {
        "should" : [{
            "term" : {
              "username" : {
                "value" : "hugo"
              }}}]}}]}}}

but when I replace match_all with the following

"query_string" : {
        "query" : "bytes" }

I get no results.

Any ideas on what I can do to make this happen?

Thanks in advance

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.