1

I was using bulk insertion on my ElasticSearch 1.0 and NEST 1.0. Now I moved to ElasticSearch 2.0 and NEST 2.0 and the bulk insertion throws a stackoverflow (!) exception. My gut feeling is that an infinite recursion is taking place and it consumes the entire stack.

this is my POCO

[ElasticsearchType(Name = "MyDoc")]
public class MyDoc: DynamicResponse
{
    [String(Store = false, Index = FieldIndexOption.NotAnalyzed)]
    public string HistoryId { get; set; }

    [String(Store = false, Index = FieldIndexOption.NotAnalyzed)]
    public string FileId { get; set; }

    [Date(Store = false)]
    public DateTime DateTime { get; set; }
}

That's how I create the mapping:

elastic.Map<MyDoc>(m => m.Index(indexName).AutoMap());

Bulk insertion is done in two steps

First I create the descriptor:

        List<dynamic> dataRecordList;

        var descriptor = new BulkDescriptor();

        if (dataRecordList == null || dataRecordList.Count == 0)
        {
            return;
        }

        foreach (var dataRecord in dataRecordList)
        {
            var nonClosedDataRecord = dataRecord;

            descriptor.Index<object>(record => record.Index(indexName).Type("MyDoc").Document(nonClosedDataRecord));
        }

Then I call the NEST bulk() method

        var bulkResponse = elastic.Bulk(d => descriptor);

I get the stackoverflow exception inside the foreach, when calling descriptor.Index()

EDIT

An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

Unfortunately no more details are available as the exception occurred on an external code (system or framework?)

Gianluca Ghettini
  • 11,129
  • 19
  • 93
  • 159
  • @Rob here we go. Looks like there are no more details – Gianluca Ghettini Mar 01 '16 at 12:03
  • Can you provide a more complete example of the descriptor creation; in your example, the `dataRecordList` is never initialized. Have you tried serializing the bulk descriptor in isolation? Does that work? – Russ Cam Mar 02 '16 at 03:07
  • @RussCam please don't look at this question anymore. I did a little bit of investigation and the problem boils down to this: http://stackoverflow.com/questions/35745689/nest-2-0-doesnt-persist-some-fields-into-elasticsearch-2-0 – Gianluca Ghettini Mar 02 '16 at 11:19
  • cool, feel free to close this question :) – Russ Cam Mar 02 '16 at 12:26

0 Answers0