Hi good day,
I have a question regarding creating an ElasticSearch index using Python
Requests Library ( http://docs.python-requests.org/en/latest/ )
I'm not too sure if the issue I am having is with ElasticSearch or with
Python Requests library....
Background:
I'm using Requests for perform cURL requests to a ElasticSearch endpoint (
http://www.elasticsearch
.org/guide/reference/api/admin-indices-create-index.html )
In particular, I am trying to create an index setting.
This code works:
( on command line )
eugene$: curl -XPUT 'http://localhost:9200/testindex4' -d '{"settings": {
"index" : { "number_of_shards":3,"number_of_replicas":2}}}'
The above creates the expected settings.
However, doing the same thing using Requests does not work:
test_settings = {'settings': {'index': {'number_of_replicas': 2,
'number_of_shards': 3}}}
create an index with test_settings:
index_test = requests.put('http://localhost:9200/testindex',
data=test_settings) # this line is successful
get the settings of index_test
check_settings = requests.get('http://localhost:9200/testindex/_settings')
print check_settings.json()
returns the following:
{u'index_test': {u'settings': {u'index.version.created': u'200299',
u'index.number_of_shards': u'5', u'index.number_of_replicas': u'1',
u'index.settings': u'index'}}}
Notice that the index.number_of_replicas is not 2, and
index.number_of_shards is not 3.
I was wondering if there's a bug with Requests? Or is it a problem with
elasticsearch ?
Is there any way I can create an index via the Python Request Library ? (
or perhaps cURL library? )
Thanks!
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.