Answer the question
In order to leave comments, you need to log in
Why is Bulk Insert not working in Elastic Search?
Hello!
I use Nest to communicate with ElasticSearch (I took Nest from the NuGet repositories). .NET Framework 4, x86. I'm trying to add a document using the Bulk method like this:
namespace NestTestCSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var client = new ElasticsearchClient();
var p = new Phrase
{
Id = 1,
Name = "скачать1"
};
var descriptor = new BulkDescriptor();
descriptor.Index<Phrase>(op => op
.Document(p)
);
var index = client.Bulk("phrases", "phrase", descriptor);
}
}
class Phrase
{
public long Id { get; set; }
public string Name { get; set; }
}
}
{StatusCode: 400,
Method: POST,
Url: http://localhost:9200/phrases/phrase/_bulk,
Request: {},
Response: <Response stream not captured or already read to completion by serializer>
ExceptionMessage: Validation Failed: 1: no requests added;
StackTrace: }
var request = new BulkRequest()
{
Refresh = true,
Consistency = Consistency.One,
Operations = new List<IBulkOperation>
{
{ new BulkIndexOperation<Phrase>(p) { Id= "1"} }
}
};
var response = client.Bulk(request);
Метод может быть вызван только для метода, для которого значение Type.IsGenericParameter является true.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question