Indexes required to make this query fast

Suppose I have the following query:

WITH b.field1 as field1, MAX(b.field2) as field2
WHERE b.field1 = field1
WHERE b.field1 = field1 AND b.field2 = field2

This query works fine and returns the data I want but the only problem is that it is very slow (2 seconds to return) once my graph has 200k Nodes of type A

What indexes do I need to make it fast?

I have the following:

CREATE INDEX ON : A( field1, field2)
CREATE INDEX ON : A( field1)

You forgot to add :A to your 2nd match.

So the indexes don't trigger.