Using query_string on 2 fields with different analyzers does not give any result

Hi

I've read a few posts on this forum saying that when writing a query_string without specifying analyzer ElasticSearch will automatically use search_analyzer for all fields, not sure if I understood correctly, but this code does not work for example (for ES 2.4, but I've seen the same result on ES 5.2) :

PUT test_analyzer
{
  "settings": {},
  "mappings": {
    "test": {
      "properties": {
        "FR": {
          "type": "string",
          "analyzer": "french",
          "search_analyzer":"french"
        },
        "EN": {
          "type": "string",
          "analyzer": "english",
          "search_analyzer":"english"
        }
      }
    }
  }
}

POST test_analyzer/test
{
  "FR": "Terme pour"
}

GET test_analyzer/test/_search
{
  "from": 0,
  "size": 10,
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "Terme pour",
            "fields": [
              "FR",
              "EN"
            ],
            "default_operator": "and"
          }
        }
      ]
    }
  }
}

This query does not return anything.
If I remove the field "EN" then it works correctly, or if I force the "french" analyzer in the query_string.
It seems to happen if the string contains a stop word ("pour" is a french stop word).

Is this the expected behaviour or am I doing something wrong ?
I might have a work around by using multiple query_string, one for each analyzer (I have around 5 analyzers so I could do that), but still I find this behaviour quite strange.

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