Issue 1:
Hi,

Elasticsearch currently doesn't have a parameter which switches indices in append only mode. This could be interesting from performance point of view.

We are dealing with a problem of limited ingestion rate in ES. We tried to focus on a couple of hot spots to resolve potential bottlenecks. One of them was DocValues merges for sparse fields, then after changing approach synchronous translog became a bottleneck. It even seems that contention problem is not negligible: #18053. These are only a few places where we tried to find optimizations. While analyzing profiles in Java Mission Control it was hard to ignore the another major problem: versions lookup. See the image below.

Profiler shows that versions lookups are taking up to 25% of CPU time. This is a lot. Of course one could say I am showing a very specific case because I am using tiny documents in tests. I think this is not exactly true. Elasticsearch stack is much focused on logs aggregation and recently also metrics (Logstash, Kibana, Marvel, Beats, ...). Most systems designed for metric or log aggregation indices are append-only. Of course ES is general purpose distributed search and analytics engine so document versions are really important ... but in many cases append-only mode could be sufficient.

One of the major strengths of Lucene internally is that segments are append only. Why not to use this simple but powerful assumption on higher level? Not all ES use cases require concurrent update functionality in which versions control really matters. What if Elasticsearch indices are marked as append-only (on they are created. Indices have properties which cannot be changed after index is created (eg. number of shards). This could be another parameter which can be applied only on index creation.

The contention problem mentioned in #18053 would also become less painful in append-only indices. Version lookup is inside synchronized block in InternalEngine#innerIndex. This means threads are in synchronized section for a longer time than needed (in case where versions are not needed).

During tests we disabled versions control in Elasticsearch which brought us significant improvement in indexing speed. Look at the chart below. Indexing speed on the same indices (without removing old data - just changed ES version) increased by 50% only by removing a version control.

My test environment is not very powerful. Only 2 machines with 4 CPU cores each. Indices have only one replica.

https://apps.sematext.com/spm-reports/s/ucSD8cuTRr

I would really appreciate any feedback. Am I missing something obvious? Thanks

Issue 2:
Hello,

Right now if you enable Elasticsearch slow log from config - elasticsearch.yml or through api call, it will generate the logs on the data node for queries that take more then 1 second (if set like this) in ES_index_search_slowlog.log.

The problem is that it will generate these logs on the data nodes where the query hits, so you have to check each nodes to see them If you have 50 data nodes this can be quite painfully.

What we need is for the these logs to be generated at the node the request is sent to ( client node for example) and the logs should also include the ip of the machine the call was made from.

I believe this should be implemented as it will make it much easier to debug.

**I know you could manually collect all the logs and use nginx proxy in front to catch the ip and then concatenate all of them. But why do all of this ? ***