I need to copy fields from an index to another one using an ingest plugin. I have used the following query:
SearchResponse response = client.prepareSearch("index1", "index2")
.setTypes("type1", "type2")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.termQuery("multi", "test")) // Query
.setPostFilter(QueryBuilders.rangeQuery("age").from(12).to(18)) // Filter
.setFrom(0).setSize(60).setExplain(true)
.get();
In the new index I can see the fields added in it but the problem that ES increase the number of documents in the new index continuously but in reality, I have to found the same number of documents of the original index.