graphite: Reorganize the elastic search code so we can put it in chromite.

This change reorganizes the elastic search integration code so that it's
separate from the code that, for instance, reads config information from the
autotest global config. That way, it can be moved from chromite without
breaking any dependencies.

BUG=chromium:446291
TEST=Ran stats_es_functionaltest.py. Ran unit tests. Ran a butterfly-paladin
tryjob with --hwtest.

Change-Id: I0dbf135c4f1732d633e5fc9d5edb9e1f4f7199d5
Reviewed-on: https://chromium-review.googlesource.com/242701
Reviewed-by: Dan Shi <dshi@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
diff --git a/site_utils/stable_version_utils.py b/site_utils/stable_version_utils.py
index 4c849b1..6452be1 100644
--- a/site_utils/stable_version_utils.py
+++ b/site_utils/stable_version_utils.py
@@ -8,7 +8,7 @@
 import common
 import django.core.exceptions
 from autotest_lib.client.common_lib import global_config
-from autotest_lib.client.common_lib.cros.graphite import es_utils
+from autotest_lib.client.common_lib.cros.graphite import autotest_es
 from autotest_lib.frontend import setup_django_environment
 from autotest_lib.frontend.afe import models
 
@@ -66,8 +66,8 @@
         stable_version.save()
     except django.core.exceptions.ObjectDoesNotExist:
         models.StableVersion.objects.create(board=board, version=version)
-    es_utils.ESMetadata().post(type_str=_STABLE_VERSION_TYPE,
-                               metadata={'board': board, 'version': version})
+    autotest_es.post(type_str=_STABLE_VERSION_TYPE,
+                     metadata={'board': board, 'version': version})
 
 
 def delete(board):
@@ -77,5 +77,5 @@
     """
     stable_version = models.StableVersion.objects.get(board=board)
     stable_version.delete()
-    es_utils.ESMetadata().post(type_str=_STABLE_VERSION_TYPE,
-                               metadata={'board': board, 'version': get()})
\ No newline at end of file
+    autotest_es.post(type_str=_STABLE_VERSION_TYPE,
+                     metadata={'board': board, 'version': get()})