GithubHelp home page GithubHelp logo

Comments (5)

oliver006 avatar oliver006 commented on June 13, 2024

Thanks for the question. There's a good chance that the ES options have changed over time, this repo probably hasn't caught up with how things are done these days.

from elasticsearch-test-data.

kbiernat avatar kbiernat commented on June 13, 2024

It works fine on old ES (tried 5.5 first). On the new ES (7.2), with the index not being there, so it should create a new one, the output is (added printing the HTTP Error exception, hence HTTP 400):

[I 210603 11:33:30 es_test_data:55] Trying to create index http://localhost:9200/test_data
HTTP 400: Bad Request
[I 210603 11:33:30 es_test_data:61] Looks like the index exists already

from elasticsearch-test-data.

tuapuikia avatar tuapuikia commented on June 13, 2024

The refresh option is not available in ES 7 and the scheme require new index field.

diff --git a/es_test_data.py b/es_test_data.py
index 403d3f2..294ac20 100755
--- a/es_test_data.py
+++ b/es_test_data.py
@@ -43,10 +43,11 @@ def delete_index(idx_name):
 def create_index(idx_name):
     schema = {
         "settings": {
-            "number_of_shards":   tornado.options.options.num_of_shards,
-            "number_of_replicas": tornado.options.options.num_of_replicas
-        },
-        "refresh": True
+            "index": {
+                "number_of_shards":   tornado.options.options.num_of_shards,
+                "number_of_replicas": tornado.options.options.num_of_replicas
+            }
+        }
     }
 
     body = json.dumps(schema)

from elasticsearch-test-data.

oliver006 avatar oliver006 commented on June 13, 2024

That's a great find @tuapuikia - could you open a PR?

from elasticsearch-test-data.

ViggoC avatar ViggoC commented on June 13, 2024

@tuapuikia According to the reference of Create index API, the index field is optional for both 6.x and 7.x version.

from elasticsearch-test-data.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.