Prefix field with specific index name while searching on multiple indices

Let's say I have two different indices (index_a and index_b) which both have different fields. For example index_a has the field title and body and index_b has only the field body. Now I'm searching like this:

  "query": {
    "simple_query_string" : {
        "query": "\"fried eggs\" +(eggplant | potato) -frittata",
        "fields": ["title^5", "body"],
        "default_operator": "and"

And that would search on index_a in the fields title and body and on index_b in the field body. But what if I only want to search in the field body of index_b and title of index_a?

I've tried to prefix the field names with <index>.<field> but of course that does not work. But is that somehow possible without using bool, must, exists etc. Queries? My desired syntax would be

"fields": ["index_a.title^5", "index_b.body"]

or perhaps a bit more descriptive

"fields": {"title": {"boost": 5, "index": "index_a"}, "body": {"boost": 1, "index": "index_b"}]

I hope you understand what I am trying to ask and that there is a nicer solution than working with deeply nested bool, must, exists queries.

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