-
Notifications
You must be signed in to change notification settings - Fork 1.2k
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bulk does not index source #229
Comments
You shouldn't specify the It is an error with elasticsearch that is causing it to ignore some parts of the request if For simpler interface you can also look at the bulk helper which should be a lot friendlier and do the right thing here: http://elasticsearch-py.readthedocs.org/en/latest/helpers.html#elasticsearch.helpers.bulk hope this helps |
Issue filed as elastic/elasticsearch#10977 |
Still not working for the following code - from elasticsearch import Elasticsearch, helpers
es_client = Elasticsearch(hosts = [{ "host" : "localhost", "port" : 9200 }])
index_name = "test"
j = 0
actions = []
while (j <= 10):
action = {
"_index": index_name,
"_type": "doc",
"_id": j,
"_source": {
"any":"data" + str(j)
}
}
actions.append(action)
j += 1
helpers.bulk(es_client, actions)
print("results:")
for doc in es_client.search(index=index_name)['hits']['hits']:
print(doc) |
|
sorry, still not working - from elasticsearch import Elasticsearch, helpers
from time import sleep
es_client = Elasticsearch(hosts = [{ "host" : "localhost", "port" : 9200 }])
index_name = "test"
j = 0
actions = []
while (j <= 10):
action = {
"_index": index_name,
"_type": "doc",
"_id": j,
"_source": {
"any":"data" + str(j)
}
}
actions.append(action)
j += 1
helpers.bulk(es_client, actions, refresh=True)
sleep(1)
es_client.indices.refresh(index=index_name)
print("results:")
for doc in es_client.search(index=index_name)['hits']['hits']:
print(doc) |
This is what your code gives me, which is correct:
Could you provide some more information what exactly isn't working? |
The output that I get is below "version" : { I get no error when I check the stats
|
Even with the exact same versions I cannot replicate your issue, could you please make sure you are deleting and recreating the index correctly? Thanks |
I restarted the cluster and now it works fine |
Thanks, closing the issue. |
I run the following code and expect it to index the content (i.e _source) as well. Instead I get the following output -
{u'_score': 1.0, u'_type': u'doc', u'_id': u'0', u'_source': {}, u'_index': u'test'}
{u'_score': 1.0, u'_type': u'doc', u'_id': u'3', u'_source': {}, u'_index': u'test'}
{u'_score': 1.0, u'_type': u'doc', u'_id': u'1', u'_source': {}, u'_index': u'test'}
{u'_score': 1.0, u'_type': u'doc', u'_id': u'2', u'_source': {}, u'_index': u'test'}
The text was updated successfully, but these errors were encountered: