Skip to content

Commit e4baa2f

Browse files
committed
Added delete by script docs and updated async references.
1 parent 9a301ac commit e4baa2f

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

core/delete.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ <h2>By object (T)</h2>
9797
<p>Id property is inferred (can be any value type (int, string, float ...))</p>
9898

9999
<pre class="prettyprint"><code class="language-cs"><code> this.ConnectedClient.Delete(searchProject);
100-
this.ConnectedClient.DeleteAsync(searchProject, c =&gt; /* called later */);
100+
this.ConnectedClient.DeleteAsync(searchProject);
101101
</code></code></pre>
102102

103103
<h2>By IEnumerable<T></h2>
104104

105105
<pre class="prettyprint"><code class="language-cs"><code> this.ConnectedClient.Delete(searchProjects);
106-
this.ConnectedClient.DeleteAsync(searchProjects, c =&gt; /* called later */);
106+
this.ConnectedClient.DeleteAsync(searchProjects);
107107
</code></code></pre>
108108

109109
<h2>By IEnumerable<T> using bulkparameters</h2>

core/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ <h1>Indexing</h1>
8787
<p>Indexing is as simple as:</p>
8888

8989
<pre class="prettyprint"><code class="language-cs"><code>var post = new Post() { Id = 12, ... }
90-
client.Index&lt;Post&gt;(post);
90+
var status = client.Index&lt;Post&gt;(post);
9191
</code></code></pre>
9292

9393
<p>of course C# is smart enough to infer Post so</p>
9494

95-
<pre class="prettyprint"><code class="language-cs"><code>client.Index(post);
95+
<pre class="prettyprint"><code class="language-cs"><code>var status = client.Index(post);
9696
</code></code></pre>
9797

9898
<p>is sufficient. this will index post too <code>/[default index]/posts/12</code>. The typename<code>posts</code> is automatically inferred from the type.</p>
@@ -106,7 +106,8 @@ <h2>Asynchronous</h2>
106106

107107
<p>Indexing asynchronously is as easy as:</p>
108108

109-
<pre class="prettyprint"><code class="language-cs"><code>client.IndexAsync(post, (c) =&gt; /* called later */);
109+
<pre class="prettyprint"><code class="language-cs"><code>//IndexAsync returns a Task&lt;ConnectionStatus&gt;
110+
var task = client.IndexAsync(post);
110111
</code></code></pre>
111112

112113
<h2>Aditional parameters</h2>

core/update.html

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!DOCTYPE html>
44
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
55
<head>
6-
<title>NEST - Connecting</title>
6+
<title>NEST - Script Update</title>
77
<meta http-equiv="cache-control" content="no-cache" />
88
<meta http-equiv="pragma" content="no-cache" />
99
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
@@ -82,9 +82,19 @@ <h4>- Core</h4>
8282
</aside>
8383
<article>
8484
<div id="content-margin-fix">
85-
<h1>Documentation still in progress</h1>
85+
<h1>Update by script API</h1>
8686

87-
<p>This is sadly still a marker file.</p>
87+
<p>The update API allows to update a document based on a script provided. The operation gets the document (collocated with the shard) from the index, runs the script (with optional script language and parameters), and index back the result (also allows to delete, or ignore the operation). It uses versioning to make sure no updates have happened during the “get” and “reindex”. (available from <code>0.19</code> onwards).</p>
88+
89+
<pre class="prettyprint"><code class="language-cs"><code>this.ConnectedClient.Update&lt;ElasticSearchProject&gt;(u =&gt; u
90+
.Object(project)
91+
.Script(&quot;ctx._source.loc += 10&quot;)
92+
.RetriesOnConflict(5)
93+
.Refresh()
94+
);
95+
</code></code></pre>
96+
97+
<p>This is just a simple example all the options that are available (such as passing params) are available. </p>
8898

8999

90100
<p>

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ <h1>Introduction</h1>
8585

8686
<p>Indexing asynchronously is as easy as:</p>
8787

88-
<pre class="prettyprint"><code class="language-cs"><code>client.IndexAsync(post, (c) =&gt; /* called later */);
88+
<pre class="prettyprint"><code class="language-cs"><code>//IndexAsync returns a Task&lt;ConnectionStatus&gt;
89+
var task = client.IndexAsync(post);
8990
</code></code></pre>
9091

9192
<p>Searching is fluid:</p>

0 commit comments

Comments
 (0)