Add example with namespaces and ignore param
This commit is contained in:
@@ -36,6 +36,10 @@ Simple use-case::
|
|||||||
# by default we connect to localhost:9200
|
# by default we connect to localhost:9200
|
||||||
>>> es = Elasticsearch()
|
>>> es = Elasticsearch()
|
||||||
|
|
||||||
|
# create an index in elasticsearch, ignore status code 400 (index already exists)
|
||||||
|
>>> es.indices.create(index='my-index', ignore=400)
|
||||||
|
{u'acknowledged': True}
|
||||||
|
|
||||||
# datetimes will be serialized
|
# datetimes will be serialized
|
||||||
>>> es.index(index="my-index", doc_type="test-type", id=42, body={"any": "data", "timestamp": datetime.now()})
|
>>> es.index(index="my-index", doc_type="test-type", id=42, body={"any": "data", "timestamp": datetime.now()})
|
||||||
{u'_id': u'42', u'_index': u'my-index', u'_type': u'test-type', u'_version': 1, u'ok': True}
|
{u'_id': u'42', u'_index': u'my-index', u'_type': u'test-type', u'_version': 1, u'ok': True}
|
||||||
|
|||||||
Reference in New Issue
Block a user