<p dir="auto">Hi,</p>
<p dir="auto">looks like <code class="notranslate">DocumentMapper</code> is creating its own list of root field mappers:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" ...
            // UID first so it will be the first stored field to load (so will benefit from &quot;fields: []&quot; early termination
            this.rootMappers.put(UidFieldMapper.class, new UidFieldMapper());
            this.rootMappers.put(IdFieldMapper.class, idFieldMapper);
            this.rootMappers.put(RoutingFieldMapper.class, new RoutingFieldMapper());
            // add default mappers, order is important (for example analyzer should come before the rest to set context.analyzer)
            this.rootMappers.put(SizeFieldMapper.class, new SizeFieldMapper());
            this.rootMappers.put(IndexFieldMapper.class, new IndexFieldMapper());
            this.rootMappers.put(SourceFieldMapper.class, new SourceFieldMapper());
            this.rootMappers.put(TypeFieldMapper.class, new TypeFieldMapper());
            this.rootMappers.put(AnalyzerMapper.class, new AnalyzerMapper());
            this.rootMappers.put(AllFieldMapper.class, new AllFieldMapper());
            this.rootMappers.put(BoostFieldMapper.class, new BoostFieldMapper());
            this.rootMappers.put(TimestampFieldMapper.class, new TimestampFieldMapper());
            this.rootMappers.put(TTLFieldMapper.class, new TTLFieldMapper());
            this.rootMappers.put(ParentFieldMapper.class, new ParentFieldMapper());
 ..."><pre class="notranslate"> ...
            <span class="pl-c">// UID first so it will be the first stored field to load (so will benefit from "fields: []" early termination</span>
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">UidFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">UidFieldMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">IdFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-s1">idFieldMapper</span>);
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">RoutingFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">RoutingFieldMapper</span>());
            <span class="pl-c">// add default mappers, order is important (for example analyzer should come before the rest to set context.analyzer)</span>
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">SizeFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">SizeFieldMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">IndexFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">IndexFieldMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">SourceFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">SourceFieldMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">TypeFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">TypeFieldMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">AnalyzerMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">AnalyzerMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">AllFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">AllFieldMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">BoostFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">BoostFieldMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">TimestampFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">TimestampFieldMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">TTLFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">TTLFieldMapper</span>());
            <span class="pl-smi">this</span>.<span class="pl-s1">rootMappers</span>.<span class="pl-en">put</span>(<span class="pl-smi">ParentFieldMapper</span>.<span class="pl-k">class</span>, <span class="pl-k">new</span> <span class="pl-smi">ParentFieldMapper</span>());
 ...</pre></div>
<p dir="auto">and <code class="notranslate">DocumentMapperParser</code> is creating its own:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="...
        rootTypeParsers = new MapBuilder&lt;String, Mapper.TypeParser&gt;()
                .put(SizeFieldMapper.NAME, new SizeFieldMapper.TypeParser())
                .put(IndexFieldMapper.NAME, new IndexFieldMapper.TypeParser())
                .put(SourceFieldMapper.NAME, new SourceFieldMapper.TypeParser())
                .put(TypeFieldMapper.NAME, new TypeFieldMapper.TypeParser())
                .put(AllFieldMapper.NAME, new AllFieldMapper.TypeParser())
                .put(AnalyzerMapper.NAME, new AnalyzerMapper.TypeParser())
                .put(BoostFieldMapper.NAME, new BoostFieldMapper.TypeParser())
                .put(ParentFieldMapper.NAME, new ParentFieldMapper.TypeParser())
                .put(RoutingFieldMapper.NAME, new RoutingFieldMapper.TypeParser())
                .put(TimestampFieldMapper.NAME, new TimestampFieldMapper.TypeParser())
                .put(TTLFieldMapper.NAME, new TTLFieldMapper.TypeParser())
                .put(UidFieldMapper.NAME, new UidFieldMapper.TypeParser())
                .put(IdFieldMapper.NAME, new IdFieldMapper.TypeParser())
                .immutableMap();
..."><pre class="notranslate">...
        <span class="pl-s1">rootTypeParsers</span> = <span class="pl-k">new</span> <span class="pl-smi">MapBuilder</span>&lt;<span class="pl-smi">String</span>, <span class="pl-smi">Mapper</span>.<span class="pl-smi">TypeParser</span>&gt;()
                .<span class="pl-en">put</span>(<span class="pl-smi">SizeFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">SizeFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">IndexFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">IndexFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">SourceFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">SourceFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">TypeFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">TypeFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">AllFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">AllFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">AnalyzerMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">AnalyzerMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">BoostFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">BoostFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">ParentFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">ParentFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">RoutingFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">RoutingFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">TimestampFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">TimestampFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">TTLFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">TTLFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">UidFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">UidFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">put</span>(<span class="pl-smi">IdFieldMapper</span>.<span class="pl-c1">NAME</span>, <span class="pl-k">new</span> <span class="pl-smi">IdFieldMapper</span>.<span class="pl-smi">TypeParser</span>())
                .<span class="pl-en">immutableMap</span>();
...</pre></div>
<p dir="auto">From external plugin it is possible to modify only root type parsers from <code class="notranslate">DocumentMapperParser</code>, but it is the list from <code class="notranslate">DocumentMapper</code> that is used when creating <code class="notranslate">ParsedDocument</code> instance.</p>
<p dir="auto">BTW,<br>
im trying to create plugin that will add support for computed fields (based on script), i wanted to borrow some 'inspiration' from how '_all' field is implemented (as it is in a way computed field). Is implementing root field mapper the right way to do it ? I tried to use field mappers (not root), but looks like they are not used unless field value is present in indexed document (which is kinda problem for computed fields, as they are never present in source document)</p>
<p dir="auto">A use case we see a lot with users is that they want to move some data out of one index to another. Would it be possible to combine the <code class="notranslate">reindex</code> with <code class="notranslate">delete-by-query</code> essentially? After a document is indexed in the target index a delete operation will be issued on the source index.</p>
<p dir="auto">Of course this couldn't be done atomically, but even on best effort basis this would be super useful for a lot of people - essentially executing <code class="notranslate">reindex</code> and <code class="notranslate">delete-by-query</code> at the same time (on the same point in time snapshot of the index) with no additional guarantees than those two operations have individually.</p>