Multi_match on multiple indexes

I have 2 indexes that I want to multi_match fields
each indexes has different fields (schema)
for instance, idx1 has "subject" and "html_body" and idex2 has "subject" and "detail".

I have query like this

    {
    	"query": 
    		{"multi_match": {
    			"query": "unverse mars", 
    			"fields": ["html_body", "subject", "detail"], 
    			"type": "cross_fields"}
    			}
    		}
    }

2 of 3 fields ("html_body" and "detail") are using the same analyzer and I want to use 'cross_fields'

and explain shows:

"explanations" : [
    {
      "index" : "idx1",
      "valid" : true,
      "explanation" : "(detail:unvers detail:mar) (blended(terms:[html_body:unverse, subject:unverse]) blended(terms:[html_body:mars, subject:mars]))"
    },
    {
      "index" : "idx2",
      "valid" : true,
      "explanation" : "(detail:unverse detail:mars) (html_body:unvers html_body:mar) (subject:unverse subject:mars)"
    }
  ]

I also tried with 3 fields that are using same analyzer and shows the similar result - only one index is using blended

it lists all the fields on each index (understandable) and one shows blended and 2nd index doesn't. Could you help me explain why idx2 is not using blended?

are you sure that detail and subject have the same analyzers?

Thank you for your reply!
Yes, well I realized that subject wasn't :frowning: so I picked 3 fields that has same analyzer.
The fields name are: html_body , sanitized_body, and detail.

Here is the result of inspecting fields:

Index: idx1
Text Fields: ['detail[text,html_strip]', 'subject[text,None]']

Index: idx2
Text Fields: ['html_body[text,html_strip]', 'sanitized_body[text,html_strip]', 'text_body[text,None]', 'to_email[text,None]']

and here is the analyze result:

Cross Field
{
  "valid" : true,
  "_shards" : {
    "total" : 2,
    "successful" : 2,
    "failed" : 0
  },
  "explanations" : [
    {
      "index" : "idx1",
      "valid" : true,
      "explanation" : "(sanitized_body:universe sanitized_body:mars) (detail:univers detail:mar) (html_body:universe html_body:mars)"
    },
    {
      "index" : "idx2",
      "valid" : true,
      "explanation" : "(detail:universe detail:mars) (blended(terms:[html_body:univers, sanitized_body:univers]) blended(terms:[html_body:mar, sanitized_body:mar]))"
    }
  ]
}

the result looks correct to me, can you tell me what you expected? sanitized_body:universe in index 1 will result in no matches since the field is not mapped so you can just ignore this?

The result of "idx1" is identical to what would show in most_field. I was expected to see blended in "idx1" as well.

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