Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 1.9 KB

File metadata and controls

51 lines (37 loc) · 1.9 KB
code type title description
true
page
CreateOrReplaceAsync
Creates or replaces a document.

CreateOrReplaceAsync

Creates a new document in the persistent data storage, or replaces its content if it already exists.

Arguments

public async Task<JObject> CreateOrReplaceAsync( 
  string index, 
  string collection, 
  string id, 
  JObject content, 
  bool waitForRefresh = false);

Argument Type Description
index
string
Index name
collection
string
Collection name
id
string

Document ID
content
JObject
JObject representing the body of the document
waitForRefresh
bool

(false)
If true, waits for the change to be reflected for search (up to 1s)

Return

A JObject containing the document creation result.

Property Type Description
_id
string
ID of the newly created document
_version
int
Version of the document in the persistent data storage
_source
JObject
JObject representing the created document
result
string
Set to created or replaced.

Exceptions

Throws a KuzzleException if there is an error. See how to handle errors.

Usage

<<< ./snippets/create-or-replace.cs