NEST only deals with typed objects in this case passing a string will cause it to index the document into /{indexName}/string/{id}
.
Since it can't infer an id from string and you do not pass it one it will fail on that or on the fact that it can't serialize a string. I'll update the client to throw a better exception in this case.
If you want to index a document as string use the exposed Elasticsearch.NET
client like so:
client.Raw.Index(indexName, typeName, id, stringJson);
If you want elasticsearch to come up with an id you can use
client.Raw.Index(indexName, type, stringJson);
client
is the NEST
client and the Raw
property is an Elasticsearch.Net
client with the same connectionsettings.
Please note that I might rename Raw
with LowLevel
in the next beta update, still debating that.