Binary string in query ignores the filter part of the query

Hello,

I have an index in my ES (2.3) where multiple documents reside from different clients. These documents are identified by having a specific property (call it x for now). All of my queries have a filter part in their query:

filter : "some query", -> may be using analyzed fields
filter: term => x : "client name" -> not analyzed

All goes well, the filter is always applied and queries only return results from documents that belong to the client that is passed in the filter as expected.

Here's where I bumped into today: (php dump, sorry)

array:1 [
"query" => array:1 [
"bool" => array:2 [
"must" => array:1 [
0 => array:1 [
"term" => array:1 [
"name" => array:2 [
"value" => b"n'py rã©sa" => analyzed field
"boost" => 1.0
]
]
]
]
"filter" => array:1 [
0 => array:1 [
"term" => array:1 [
"x" => array:2 [
"value" => "client name" ( => non analyzed field)
"boost" => 1.0
]
]
]
]
]
]
]

is my query, as you can see, the name value is messed up! This is because I used a strtolower, instead of a mb_strtolower function. Here's the weird part, this query returns results that ignore the filter part!

Even if I put the filter as a "must" clause in the bool query... I can't wrap my ahead around the "why". As I understood it the filter will always execute the query (in filter context) without any score, so an exact match (?). Up until now this has always been the case. If I use a correct mb_strtolower, the name is not messed up and proper results are brought back from ES.

Any idea on why this happens and how I can make sure this won't happen again? I assumed adding the filter that splits the results, keeping client data away from eachother was sufficient, but now I'm thinking I should perhaps use different indices per client.

Any help is greatly appreciated!