# Helpers.bulk not inserting any data

**URL:** <https://discuss.elastic.co/t/helpers-bulk-not-inserting-any-data/162702>\
**Category:** Elasticsearch\
**Created:** [January 2, 2019, 6:56pm UTC](https://discuss.elastic.co/t/helpers-bulk-not-inserting-any-data/162702 "2019-01-02T18:56:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samvid\_Kulkarni](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@Samvid\_Kulkarni](https://discuss.elastic.co/u/Samvid_Kulkarni)\
**Post date:** [January 2, 2019, 6:56pm UTC](https://discuss.elastic.co/t/helpers-bulk-not-inserting-any-data/162702/1 "2019-01-02T18:56:22Z")

</div>

i am trying to insert data into elasticsearch using elasticsearch-python-dsl api. I am getting data from one index, then i am performing operations on it and then inserting it into another index.

below is my code.

```
client = Elasticsearch(['IP_HERE'])
s = Search(using=client, index="firewall-*", doc_type = 'doc').filter('range', **{'@timestamp': {'gte': 'now-60m' , 'lt': 'now'}}).params(request_timeout=30)
response = s.execute()
#print(response)
dict_data = {}
try:
	for hit1 in s.scan():
		source_ip.append(hit1.to_dict().get('src_ip'))
		destination_ip.append(hit1.to_dict().get('dst_ip'))
		all_data.append(hit1.to_dict())

except Exception as e:
	result.append("not able to parse json data " + str(e))

# print(dict_data)
for i in range(len(all_data)):
	if all_data[i].get('src_ip') in new_data:
		print("1")
		result.append(all_data[i])
	# print("--")
	if all_data[i].get('dst_ip') in new_data:
		print("2")
		result.append(all_data[i])

jdata = ast.literal_eval(json.dumps(result)) 
print(json.dumps(jdata))
helpers.bulk(client,jdata, index='c2', doc_type='doc')

```

I have elasticsearch 6.x and i need to insert not more than 100 results. I am not getting any error using above code but it is not inserting any data either. Can anyone tell me whats wrong with my code?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 30, 2019, 7:03pm UTC](https://discuss.elastic.co/t/helpers-bulk-not-inserting-any-data/162702/2 "2019-01-30T19:03:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
