anchor.diff:        };
   
       passthru.elkPackages = elk;
  -    testScript = ''
  +    testScript =
  +      let
  +        valueObject = lib.optionalString (lib.versionAtLeast elk.elasticsearch.version "7") ".value";
  +      in ''
         import json
   
   
  -      def total_hits(message):
  +      def expect_hits(message):
             dictionary = {"query": {"match": {"message": message}}}
             return (
  -              "curl --silent --show-error '${esUrl}/_search' "
  +              "curl --silent --show-error --fail-with-body '${esUrl}/_search' "
                 + "-H 'Content-Type: application/json' "
                 + "-d '{}' ".format(json.dumps(dictionary))
  -              + "| jq .hits.total"
  +              + " | tee /dev/console"
  +              + " | jq -es 'if . == [] then null else .[] | .hits.total${valueObject} > 0 end'"
  +          )
  +
  +
  +      def expect_no_hits(message):
  +          dictionary = {"query": {"match": {"message": message}}}
  +          return (
  +              "curl --silent --show-error --fail-with-body '${esUrl}/_search' "
  +              + "-H 'Content-Type: application/json' "
  +              + "-d '{}' ".format(json.dumps(dictionary))
  +              + " | tee /dev/console"
  +              + " | jq -es 'if . == [] then null else .[] | .hits.total${valueObject} == 0 end'"
             )
   
   
         def has_metricbeat():
             dictionary = {"query": {"match": {"event.dataset": {"query": "system.cpu"}}}}
             return (
  -              "curl --silent --show-error '${esUrl}/_search' "
  +              "curl --silent --show-error --fail-with-body '${esUrl}/_search' "
                 + "-H 'Content-Type: application/json' "
                 + "-d '{}' ".format(json.dumps(dictionary))
  -              + "| jq '.hits.total > 0'"
  +              + " | tee /dev/console"
  +              + " | jq -es 'if . == [] then null else .[] | .hits.total${valueObject} > 0 end'"
             )
   
   
  
positive.code:       # TODO: extend this test with multiple elasticsearch nodes
        #       and see if the status turns "green".
        one.wait_until_succeeds(
            "curl --silent --show-error '${esUrl}/_cluster/health' | jq .status | grep -v red"
        )
  
        with subtest("Perform some simple logstash tests"):
  
negative.code:       with subtest("Kibana is healthy"):
            one.wait_for_unit("kibana.service")
            one.wait_until_succeeds(
                "curl --silent --show-error --fail-with-body 'http://localhost:5601/api/status'"
                + " | jq -es 'if . == [] then null else .[] | .status.overall.state == \"green\" end'"
            )
  
        with subtest("Metricbeat is running"):
            one.wait_for_unit("metricbeat.service")
  
        with subtest("Metricbeat metrics arrive in elasticsearch"):
            one.wait_until_succeeds(has_metricbeat())
  
        with subtest("Logstash messages arive in elasticsearch"):
            one.wait_until_succeeds(expect_hits("flowers"))
            one.wait_until_succeeds(expect_no_hits("dragons"))
  
      '' + lib.optionalString (elk ? journalbeat) ''
        with subtest(
  