Hey,
it is executed before the documents are stored, because the analyzed strings need to be stored in the inverted index.
Further infos:
- https://www.elastic.co/guide/en/elasticsearch/guide/current/analysis-intro.html
- https://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-analysis.html
--Alex