The best case scenario is to use both the "final" datastore-indexes
and datastore-indexes-auto.xml
in production using Automatic index configuration. (I don't know if it works using a standard maven built war using src/main/webapp
though).
I don't think it's that much of a victory, since using a generated file for production is usually a source of confusion.
Anyway you will still have to first run your queries on the dev server to get indexes generated. The production server does not generate indexes on the fly, and there is no way to programmatically create indexes.
The whole point is to make sure that your indexes are tailor made for your queries.