Sub query not working as expected trying to order by then group by, MySQL 5.5 vs 5.7
You are correct, this was different in earlier versions


  ...However, in MySQL prior to version 5.7 the default behaviour has been
  more forgiving because it will not complain and then arbitrarily
  choose any value! It also has an ANY_VALUE() function that could be
  used as another solution to this question if you really needed the
  same behaviour as before...


Source

But this change is a good thing, as the error used to be silenced. 
I would recommend changing the query to get the results you want. I believe you want the one where field1 is the largest.

Field1 is the primary key, so you could possibly do something like the following

SELECT docs.field1,docs.field2,docs.field3,docs.field4
FROM 
(
SELECT max(field1) as field1 ,field2 FROM docs
GROUP BY field2
) temp
INNER JOIN docs
on temp.field1 = docs.field1 
ORDER BY field2, field1 desc;


DBFiddle

The other way around this are to either disable the functionality or use ANY_VALUE() but I would advise against that.

ANY_VALUE() can give an inconsistent resultset, an example could be the number 50 instead of the expected 17 as field4 where the field1 column = 27908. 

DBFiddle