Update single record with asp.net client

I want to update individual record at Manticore using asp.net client.
How to prepare object for update ?

In UpdateDocumentRequest, there is dictionary for doc (<string, object>)
Can you please give example how to pass value in this dictionary ?

I read about replace and update but there is not valid example.
what I have to pass for string and object in dictionary.

Thanks in advance.

Hi,
an update request can be executed like this:

Dictionary<string, Object> doc = new Dictionary<string, Object>();
doc.Add("some_index_field", "some_new_value");
UpdateDocumentRequest updateDocumentRequest = new UpdateDocumentRequest(
    index: "your_index_name", 
    id: your_doc_id, 
    doc: doc
);
indexApi.Update(updateDocumentRequest);

I tried with same example given by you

Dictionary<string, Object> doc = new Dictionary<string, Object>();
doc.Add("name", "Update product number one");
UpdateDocumentRequest updateDocumentRequest = new UpdateDocumentRequest(
	index: "products",
	id: 1,
	doc: doc
);
indexApi.Update(updateDocumentRequest);

But I am getting error/exception as below:

ManticoreSearch.Client.ApiException: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type ‘ManticoreSearch.Model.UpdateResponse’ because the type requires a JSON object (e.g. {“name”:“value”}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {“name”:“value”}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.

Object should be any (string, int, bool, list, etc.) so why I am getting this error ?

Here is my table

var utilsApi = new UtilsApi();
string tableBody = "create table if not exists products (ProductId text, Name text,Sku text,ShortDescription text,FullDescription text,Price float,Published bool,ManufacturerPartNumber text,VendorId integer,Vendor text)";
utilsApi.Sql(tableBody, true);

Now I am preparing update document request as below

Dictionary<string, Object> doc = new Dictionary<string, Object>
{
	{"ProductId", "1"},
	{"Name", "build-your-own-computer 222222"},
	{"Sku", "SKU_Product_1"},
	{"ShortDescription",  ""},
	{"FullDescription", ""},
	{"Price", 1200.0000},
	{"Published", true},
	{"ManufacturerPartNumber", ""},
	{"VendorId", 0},
	{"Vendor", ""}
};
UpdateDocumentRequest updateDocumentRequest = new UpdateDocumentRequest(
	index: "products",
	id: 1,
	doc: doc
);
UpdateResponse updateResponse = indexApi.Update(updateDocumentRequest);

When I try to update this why I am getting error/exception as mentioned in above question ?
Something wrong with my request ?
Anyone please suggest solution for this

I tried with replace method, it working fine and update existing record.

InsertDocumentRequest insertDocumentRequest = new InsertDocumentRequest(
	index: "products",
	id: product.Id,
	doc: doc
);
SuccessResponse replaceResponse = indexApi.Replace(insertDocumentRequest);

Since you get the same error as the one mentioned in your previous post, investigating that case will probably help with this one too.