Realtime search based on 2 indexes

Hello to all!

I need some kind of advice, so in general, I have 2 indexes:

  1. The first index its aliases ex: my_name -> Barak Trump (an amount in first interactions about 50 000 can be much more)

  2. Seconds Index it's a huge amount of documents (about 8M records with raw text from google OCR)

So how can I find aliases match from the first index in second???

Iterate in realtime one alias -> one query = it's the dead way I will meet all timeouts which are possible.

So I asking real advice on how anybody solved this?

Best regards, Ivan!

will works something like this:

    {
        "query": {
            "bool": {
                "must": [
                    {
                        "match_phrase": {
                          "file_path": "charts/20190609/5cfcd176b70ba.pdf"
                        }
                    }
                ],
                "filter": {
                    "bool": {
                        "should": [
                            {
                                "query_string": {
                                    "query": "aliases_master_07_08_2020_13_46.alias_master_name",
                                    "analyze_wildcard": true,
                                    "default_field": "*"
                                }
                            }
                        ]
                    }
                }
            }
        }
    }

@elastick

What you are describing is a join between two indices which Elasticsearch does not support. I would recommend looking at replacing your alias/synonym index with search time synonyms.