You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2019/06/10 15:05:05 UTC

[kibble] branch master updated: If ES >= 7, mappings need to be rooted (no _doc type!)

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git


The following commit(s) were added to refs/heads/master by this push:
     new f085893  If ES >= 7, mappings need to be rooted (no _doc type!)
f085893 is described below

commit f0858933719cad2cf0e0bb9ad19b714af36146ed
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Jun 10 17:05:00 2019 +0200

    If ES >= 7, mappings need to be rooted (no _doc type!)
---
 setup/setup.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/setup/setup.py b/setup/setup.py
index 7e93032..02b4d56 100644
--- a/setup/setup.py
+++ b/setup/setup.py
@@ -163,9 +163,13 @@ def createIndex():
         )
 
     es6 = True if int(es.info()['version']['number'].split('.')[0]) >= 6 else False
+    es7 = True if int(es.info()['version']['number'].split('.')[0]) >= 7 else False
     if not es6:
         print("New Kibble installations require ElasticSearch 6.x or newer! You appear to be running %s!" % es.info()['version']['number'])
         sys.exit(-1)
+    # If ES >= 7, _doc is invalid and mapping should be rooted
+    if es7:
+        mappings['mappings'] = mappings['mappings']['_doc']
     # Check if index already exists
     if es.indices.exists(dbname+"_api"):
         if args.skiponexist: # Skip this is DB exists and -k added