Skip to content

Commit a1edc80

Browse files
committed
updated template documentation
1 parent 4fcf565 commit a1edc80

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html><html><head><title>Nest - Connecting</title><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="pragma" content="no-cache"><meta http-equiv="content-type" content="text/html;charset=utf-8"><meta http-equiv="expires" content="0"><meta name="description" content="elasticsearch"><meta name="keywords" content="nest, elasticsearch, .net, client"><meta name="author" content="martijn laarman"><link rel="stylesheet" type="text/css" href="/styles/layout.css"><link rel="stylesheet" type="text/css" href="/styles/pygments.css"><link href="http://fonts.googleapis.com/css?family=Ubuntu+Mono|Ubuntu" rel="stylesheet" type="text/css"><link href="/prettify/prettify.css" type="text/css" rel="stylesheet"><link href="/prettify/sunburst.css" type="text/css" rel="stylesheet"><script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script><script type="text/javascript" src="/prettify/prettify.js"></script><script type="text/javascript" src="/prettify/fix_code_tags.js"></script></head><body><section id="site"><div class="actions"><iframe src="http://ghbtns.com/github-btn.html?user=Mpdreamz&amp;repo=NEST&amp;type=fork&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe><iframe src="http://ghbtns.com/github-btn.html?user=Mpdreamz&amp;repo=NEST&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe></div><aside><ul id="top_left_menu"><h4>External</h4><li><a href="http://www.elasticsearch.org" target="_blank">Elasticsearch Docs</a></li><li><a href="http://mpdreamz.mit-license.org/" target="_blank">MIT license</a></li></ul></aside><section id="content"><aside id="menu"><ul id="top_left_menu"><li><a href="/">+ Concepts</a></li><li><a href="/core/" class="">+ Core</a></li><h4>- Indices</h4><ul><li><a href="/indices/aliases.html" class="">Aliases</a></li><li><a href="/indices/analyze.html" class="">Analyze</a></li><li><a href="/indices/create-indices.html" class="selected">Create Index</a></li><li><a href="/indices/delete-indices.html" class="">Delete Index</a></li><li><a href="/indices/open-close.html" class="">Open/Close Index</a></li><li><a href="/indices/get-settings.html" class="">Get Settings</a></li><li><a href="/indices/get-mapping.html" class="">Get Mapping</a></li><li><a href="/indices/put-mapping.html" class="">Put Mapping</a></li><li><a href="/indices/delete-mapping.html" class="">Delete Mapping</a></li><li><a href="/indices/refresh.html" class="">Refresh</a></li><li><a href="/indices/optimize.html" class="">Optimize</a></li><li><a href="/indices/flush.html" class="">Flush</a></li><li><a href="/indices/snapshot.html" class="">Snapshot</a></li><li><a href="/indices/update-settings.html" class="">Update Settings</a></li><li><a href="/indices/templates.html" class="">Templates</a></li><li><a href="/indices/stats.html" class="">Stats</a></li><li><a href="/indices/status.html" class="">Status</a></li><li><a href="/indices/segments.html" class="">Segments</a></li><li><a href="/indices/clear-cache.html" class="">Clear Cache</a></li><li><a href="/indices/indices-exists.html" class="">Indices Exists</a></li></ul><li><a href="/cluster/health.html" class="">+ Cluster</a></li><li><a href="/search/basics.html" class="">+ Search</a></li><li><a href="/facets/handling.html" class="">+ Facets</a></li><li><a href="/query/text.html" class="">+ Query DSL</a></li><li><a href="/filter/and.html" class="">+ Filter DSL</a></li></ul></aside><article><div id="content-margin-fix"><h1>Create index</h1>
2+
<p>The create index API allows to instantiate an index. ElasticSearch provides support for multiple indices, including executing operations across several indices. Each index created can have specific settings associated with it.</p>
3+
<h2>Note</h2>
4+
<p>When adding settings strip the <code>index.</code> prefix when passing settings found for example here:<a href="http://www.elasticsearch.org/guide/reference/index-modules/">http://www.elasticsearch.org/guide/reference/index-modules/</a></p>
5+
<h2>Simple example</h2>
6+
<pre><code>var client = this.ConnectedClient;
7+
var settings = new IndexSettings();
8+
settings.NumberOfReplicas = 1;
9+
settings.NumberOfShards = 5;
10+
settings.Add(&quot;merge.policy.merge_factor&quot;,&quot;10&quot;);
11+
settings.Add(&quot;search.slowlog.threshold.fetch.warn&quot;, &quot;1s&quot;);
12+
client.CreateIndex(&quot;myindexname&quot;, settings);</code></pre>
13+
<h2>Create index with settings and mappings in one go fluently</h2>
14+
<pre><code>client.CreateIndex(&quot;myindexname&quot;, c =&gt; c
15+
.NumberOfReplicas(0)
16+
.NumberOfShards(1)
17+
.Settings(s=&gt;s
18+
.Add(&quot;merge.policy.merge_factor&quot;,&quot;10&quot;)
19+
.Add(&quot;search.slowlog.threshold.fetch.warn&quot;, &quot;1s&quot;)
20+
)
21+
.AddMapping&lt;ElasticSearchProject&gt;(m =&gt; m.MapFromAttributes())
22+
.AddMapping&lt;Person&gt;(m =&gt; m.MapFromAttributes())
23+
);</code></pre>
24+
</div></article></section></section></body></html>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html><html><head><title>Nest - Connecting</title><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="pragma" content="no-cache"><meta http-equiv="content-type" content="text/html;charset=utf-8"><meta http-equiv="expires" content="0"><meta name="description" content="elasticsearch"><meta name="keywords" content="nest, elasticsearch, .net, client"><meta name="author" content="martijn laarman"><link rel="stylesheet" type="text/css" href="/styles/layout.css"><link rel="stylesheet" type="text/css" href="/styles/pygments.css"><link href="http://fonts.googleapis.com/css?family=Ubuntu+Mono|Ubuntu" rel="stylesheet" type="text/css"><link href="/prettify/prettify.css" type="text/css" rel="stylesheet"><link href="/prettify/sunburst.css" type="text/css" rel="stylesheet"><script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script><script type="text/javascript" src="/prettify/prettify.js"></script><script type="text/javascript" src="/prettify/fix_code_tags.js"></script></head><body><section id="site"><div class="actions"><iframe src="http://ghbtns.com/github-btn.html?user=Mpdreamz&amp;repo=NEST&amp;type=fork&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe><iframe src="http://ghbtns.com/github-btn.html?user=Mpdreamz&amp;repo=NEST&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe></div><aside><ul id="top_left_menu"><h4>External</h4><li><a href="http://www.elasticsearch.org" target="_blank">Elasticsearch Docs</a></li><li><a href="http://mpdreamz.mit-license.org/" target="_blank">MIT license</a></li></ul></aside><section id="content"><aside id="menu"><ul id="top_left_menu"><li><a href="/">+ Concepts</a></li><li><a href="/core/" class="">+ Core</a></li><h4>- Indices</h4><ul><li><a href="/indices/aliases.html" class="">Aliases</a></li><li><a href="/indices/analyze.html" class="">Analyze</a></li><li><a href="/indices/create-indices.html" class="">Create Index</a></li><li><a href="/indices/delete-indices.html" class="selected">Delete Index</a></li><li><a href="/indices/open-close.html" class="">Open/Close Index</a></li><li><a href="/indices/get-settings.html" class="">Get Settings</a></li><li><a href="/indices/get-mapping.html" class="">Get Mapping</a></li><li><a href="/indices/put-mapping.html" class="">Put Mapping</a></li><li><a href="/indices/delete-mapping.html" class="">Delete Mapping</a></li><li><a href="/indices/refresh.html" class="">Refresh</a></li><li><a href="/indices/optimize.html" class="">Optimize</a></li><li><a href="/indices/flush.html" class="">Flush</a></li><li><a href="/indices/snapshot.html" class="">Snapshot</a></li><li><a href="/indices/update-settings.html" class="">Update Settings</a></li><li><a href="/indices/templates.html" class="">Templates</a></li><li><a href="/indices/stats.html" class="">Stats</a></li><li><a href="/indices/status.html" class="">Status</a></li><li><a href="/indices/segments.html" class="">Segments</a></li><li><a href="/indices/clear-cache.html" class="">Clear Cache</a></li><li><a href="/indices/indices-exists.html" class="">Indices Exists</a></li></ul><li><a href="/cluster/health.html" class="">+ Cluster</a></li><li><a href="/search/basics.html" class="">+ Search</a></li><li><a href="/facets/handling.html" class="">+ Facets</a></li><li><a href="/query/text.html" class="">+ Query DSL</a></li><li><a href="/filter/and.html" class="">+ Filter DSL</a></li></ul></aside><article><div id="content-margin-fix"><h1>Delete Index</h1>
2+
<p>The delete index API allows to delete an existing index.</p>
3+
<p>The delete index API can also be applied to more than one index, or on <code>_all</code> indices (be careful!). All indices will also be deleted when no specific index is provided. In order to disable allowing to delete all indices, set <code>action.disable_delete_all_indices</code> setting in the config to <code>true</code>.</p>
4+
<h2>Examples</h2>
5+
<p>Using the default index</p>
6+
<pre><code>this.ConnectedClient.DeleteIndex&lt;ElasticSearchProject&gt;()</code></pre>
7+
<p>or more explictly</p>
8+
<pre><code>this.ConnectedClient.DeleteIndex(&quot;index&quot;)</code></pre>
9+
</div></article></section></section></body></html>

new_docs/contents/indices/templates.markdown

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,17 @@ menuitem: templates
88

99
# Index Templates API
1010

11-
The index templates api is not currently mapped in NEST.
11+
Allows you to define templates on the cluster that are applied everytime an index is created.
12+
13+
var putResponse = this._client.PutTemplate(t=>t
14+
.Name("put-template-with-settings")
15+
.Template("donotinfluencothertests-*")
16+
.Settings(s=>s
17+
.Add("index.number_of_shards", 3)
18+
.Add("index.number_of_replicas", 2)
19+
)
20+
.AddMapping<dynamic>(s=>s
21+
.TypeName("mytype")
22+
.DisableAllField()
23+
)
24+
);

0 commit comments

Comments
 (0)