Description
Today we have a limit in full-text query to limit the number of field expansion that we allow. The limit is controllable with the indices.query.bool.max_clause_count
setting and we count all fields including unmapped ones. However for queries that target multiple indices it is possible that the list of field to expand the query to become bigger than the max clause setting even if the list of applicable field per index/shard is small. So for instance a query with 2000 fields where 1000 fields belong to one index and the other 1000 belong to the other index would fail because the total is greater than the max clause count. It is also important to note that we currently translate any unmapped field into a MatchNoDocsQuery to ease debugging but we could also completely ignore these unmapped fields if we wanted. I am opening this issue mainly to discuss this behavior and to assess whether it would be beneficial to only count the fields that will make a difference (the mapped ones).