Use multiple analyzers by field on query

I want to do a multi_match query for 3 different fields, but I want 2 of those fields (indexed as text using standard analyzer) to use the english language analyzer and the 3rd one to use the standard analyzer. I want to do this on the query side, before trying to modify anything on the index mapping.
I heard something about adding a .english notation after the field name to use english analyzer, which seems successfully when specifying it for one field, but I'm getting empty results when specifying it for two.
Here is the example of the query I'm trying

GET myindex/_search
{
   "query": {
      "multi_match": {
          "query": "example of the text imput containing 843u43ew machine codes",
          "type": "most_fields", 
          "fields": ["field1.english","field2.english", "field3"]
      }    
   }
}

Could you please let me know if I'm doing something wrong?

That should work asd long as you have multi-fields correctly configured in your mappings for those fields. What does your mappings look like?

I don't have configured multi-fields with the english analyzer. I'm assuming that adding the .english is doing the analyzer specification.
Here are the mappings I have for those fields:

{
  "mappings": {
    "_doc": {
      "properties": {
        "field1": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "keyword"
            }
          }
        },
        "field2": {
          "type": "text"
        },
        "field3": {
          "type": "keyword"
        }
      }
    }
  }
}

Yes, you will need to add that and potentially reindex for it to work.

I'm looking for a way to do this without altering the index if it's possible.
Is the assumption that adding .english to the field name is changing the analyzer to english wrong? Why the query is running when I use field1.english if that field name is not configured as a multi-field?

I've honestly never heard of that?

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