Elasticsearch using eland for python fails to write when having nan in the dataset

0

I am creating pandas dataset with such that 'num_specimen_seen' is having one value null. I am defining nan using the math.nan. The dataset df is saved in haze.csv file.

df = pd.DataFrame({'num_legs': [2, 4, 8, 0],
                   'num_wings': [2, 0, 0, 0],
                   'num_specimen_seen': [10, 2,math.nan, 8]},
                  )
df.to_csv('haze.csv')
Unnamed: 0  num_legs    num_wings   num_specimen_seen
0   0   2   2   10.0
1   1   4   0   2.0
2   2   8   0   NaN
3   3   0   0   8.0

I am uploading this haze.csv to Elasticsearch using eland as follows:

ed.csv_to_eland(
...      "haze.csv",
...      es_client='http://localhost:9200',
...      es_dest_index='haze',
...      es_refresh=True,
...      index_col=0
... )

But it is giving an error as follows:

BulkIndexError: 1 document(s) failed to index.

Can any one help me how to map nan into Elasticsearch?

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