Search in multi_field type

Usecase: Typeahead search:
I have a question with Multi_field search, the property with type I have is:

content: {
       type: "string"
       fields: {
             raw: {
                     type: "string"
                     index: "not_analyzed"
                    }
      }
}

So as and when I type I must be able to fetch the results, now what is optimal way to search against content and content.raw field?

I was thinking of a query like this?

    "bool" : {
        "should" : [ 
    		"match" : { 
    			"content" : { "query" : "post", "operator" : "and" } 
   			}, 
    		"match" : { 
    			"content.raw" : { "query" : "postin", "operator" : "and" } 
    		}
    	]
}

Well, should should be an array of clauses.

So something like:

"bool" : {
        "should" : [ 
    		"match" : { 
    			"content" : { "query" : "post", "operator" : "and" } 
   			}, 
    		"match" : { 
    			"content.raw" : { "query" : "postin", "operator" : "and" } 
    		}
    	]
}

Thanks @dadoonet My concern is the query itself. Not the syntax.
I am in the analysis phase. So it would be very helpful if u can help me with the optimal query for the problem.
I have edited my syntax based on your comments. Many Thanks!!!

So yes, IMO the way you write the query is correct.

Thank You :smile: