anchor.diff:  First, let's index a simple doc:
   
   [source,console]
  ---------------------------------------------------
  +----
   PUT test/_doc/1
   {
     "counter" : 1,
     "tags" : ["red"]
   }
  ---------------------------------------------------
  +----
  +// TESTSETUP
   
   To increment the counter, you can submit an update request with the
   following script:
   
   [source,console]
  ---------------------------------------------------
  +----
   POST test/_update/1
   {
     "script" : {
  
positive.code:   },
    "upsert": {}
  }
  --------------------------------------------------
  // TEST[s/"id": "my_web_session_summariser"/"source": "ctx._source.page_view_event = params.pageViewEvent"/]
  // TEST[continued]
  
  [discrete]
  [[doc_as_upsert]]
  
negative.code:   },
    "doc_as_upsert": true
  }
  ----
  
  [NOTE]
  ====
  Using <<ingest,ingest pipelines>> with `doc_as_upsert` is not supported.
  