0

How can I set an index pattern with python (before putting any docs)? I came up with this, am I on the right tracks?

query = 
"settings": {
        "number_of_shards": 2,
        "number_of_replicas": 1,
        "mappings": {...},
        "index-pattern" : {
            "title" : "myindex",
            "timeFieldName" : "sendTime",
            "fields" : """[{"name":"_id","type":"string","esTypes":["_id"],"count":0, ...]}"""

es_client.indices.create(index = "myindex" , body = query)

Am I missing sth?

(The thing is, if the index pattern is not defined, I can't use Dashboard. By Just defining mappings and similar stuff (analysis, ...) but having no docs, the index is not known to Kibana for creating the index pattern. At least one document should be present/added.

I found that there was an issue about this, and it seems to be solved; Yet I'm using the latest version (7.8) and still have this problem.

Update: Made it this far, but still stuck there!
Update: Solved! See the above link

Xadra
  • 21
  • 9
  • FYI regarding your comment about being on the latest version: The fix for the issue will be released in 7.9 (I work at Elastic) – sethmlarson Jul 30 '20 at 04:27
  • @sethmlarson Thanks for the heads-up! Actually I managed to do it! So I'll remove this one. Best of luck. – Xadra Jul 30 '20 at 06:36
  • @ArdaS how did you manage to do it? The only way I seem to be able to do it is to create index with 1 fake document, then create pattern, then start ingesting data, then delete fake document, which is not scalable.... – insta catering Sep 03 '20 at 23:19
  • @sethmlarson I might be a bit of an idiot but was this released in 7.9? can't seem to see it in the 7.9 release notes, though 7.9.1 IS available (with no release notes) so could it be there? – insta catering Sep 03 '20 at 23:20
  • @instacatering Use 7.9.1, the release notes might not be on master. I'll take a look. – sethmlarson Sep 04 '20 at 00:10
  • @instacatering Did u see the link to the answer? No need to create a fake doc beforehand. – Xadra Sep 04 '20 at 18:11

0 Answers0