question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example code on the documentation page does not work

See original GitHub issue

Hey,

I have tried the example code with Elasticsearch 1.4.0 and ElasticSearch 1.5.2. And I am getting errors:

>>> from datetime import datetime
>>> from elasticsearch import Elasticsearch
>>> doc = {
...     'author': 'kimchy',
...     'text': 'Elasticsearch: cool. bonsai cool.',
...     'timestamp': datetime.now(),
... }
>>> es= Elasticsearch(hosts=['localhost:9200'])
>>> es
<Elasticsearch([{u'host': u'localhost', u'port': 9200}])>
>>> res = es.index(index="test-index", doc_type='tweet', id=1, body=doc)
Traceback (most recent call last):
  ...
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.NotFoundError: TransportError(404, u'IndexMissingException[[test-index] missing]')

What else is needed to get it run?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
chfwcommented, Jan 22, 2016

Inserting this line before it gets it working:

>>>
>>> es.indices.create("test-index", {'mappings': {'tweet':{'properties': {'author':{'type':'string'},'text':{'type':'string'},'timestamp':{'type':'date'}}}}}) # <--
{u'acknowledged': True}
>>> res = es.index(index="test-index", doc_type='tweet', id=1, body=doc)
0reactions
chfwcommented, Jan 22, 2016

Thanks again! I will check dsl out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to generate DocC documentation - Apple Developer
Even the sample Apple SlothCreator package example does not work. I am using the latest ship Xcode (13.2.1), and I downloaded the sample...
Read more >
freeCodeCamp: TECHNICAL DOCUMENTATION PAGE
Free Discord Group: https://www.dorscodingschool.com/discord▻ Get the solution to these problems and an eBook on 'How to Become a ...
Read more >
How to Write Doc Comments for the Javadoc Tool - Oracle
This document describes the style guide, tag and image conventions we use in documentation comments for Java programs written at Java Software, Oracle....
Read more >
Recommended XML tags for C# documentation comments
This article provides the syntax and definitions for recommended tags for XML documentation.
Read more >
Documentation for Visual Studio Code
Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found