Skip to content
This repository has been archived by the owner on Sep 23, 2022. It is now read-only.

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eriky committed Mar 18, 2012
1 parent 4b09220 commit a3dc9c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
20 changes: 10 additions & 10 deletions doc/Documentation.rst
Expand Up @@ -64,26 +64,26 @@ stuff. First of all let's request the status of the ElasticSearch cluster:


``>>>es.status()`` ``>>>es.status()``


``{u'indices': {}, u'ok': True, u'_shards': {u'successful': 0, u'failed': 0, u'total': 0}}`` ::

{u'indices': {}, u'ok': True, u'_shards': {u'successful': 0, u'failed': 0, u'total': 0}}


Well, great. Now let's create an index. Open the create index API page at Well, great. Now let's create an index. Open the create index API page at
http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html
and read that page. Now we are going to map this knowledge to ESClient. and read that page. Now we are going to map this knowledge to ESClient.


First of all we need to create a request body that allows us the specify First of all we need to create a request body that allows us the specify
the number of shards and number of replicas we want for our index the number of shards and number of replicas we want for our index::

::


body= { body= {
"settings" : { "settings" : {
"index" : { "index" : {
"number_of_shards" : 1, "number_of_shards" : 1,
"number_of_replicas" : 0 "number_of_replicas" : 0
} }
} }
} }


With this, we can create an index easily: With this, we can create an index easily:


``es.create_index("contacts", body=body)`` ``>>> es.create_index("contacts", body=body)``
18 changes: 10 additions & 8 deletions doc/documentation.html
Expand Up @@ -189,24 +189,26 @@ <h1><a id="an-interactive-python-session" name="an-interactive-python-session">A
<p>Now that we have an ESClient instance, we can start doing some interesting <p>Now that we have an ESClient instance, we can start doing some interesting
stuff. First of all let's request the status of the ElasticSearch cluster:</p> stuff. First of all let's request the status of the ElasticSearch cluster:</p>
<p><tt class="docutils literal"><span class="pre">&gt;&gt;&gt;es.status()</span></tt></p> <p><tt class="docutils literal"><span class="pre">&gt;&gt;&gt;es.status()</span></tt></p>
<p><tt class="docutils literal"><span class="pre">{u'indices':</span> <span class="pre">{},</span> <span class="pre">u'ok':</span> <span class="pre">True,</span> <span class="pre">u'_shards':</span> <span class="pre">{u'successful':</span> <span class="pre">0,</span> <span class="pre">u'failed':</span> <span class="pre">0,</span> <span class="pre">u'total':</span> <span class="pre">0}}</span></tt></p> <pre class="literal-block">
{u'indices': {}, u'ok': True, u'_shards': {u'successful': 0, u'failed': 0, u'total': 0}}
</pre>
<p>Well, great. Now let's create an index. Open the create index API page at <p>Well, great. Now let's create an index. Open the create index API page at
<a class="reference" href="http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html">http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html</a> <a class="reference" href="http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html">http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html</a>
and read that page. Now we are going to map this knowledge to ESClient.</p> and read that page. Now we are going to map this knowledge to ESClient.</p>
<p>First of all we need to create a request body that allows us the specify <p>First of all we need to create a request body that allows us the specify
the number of shards and number of replicas we want for our index</p> the number of shards and number of replicas we want for our index:</p>
<pre class="literal-block"> <pre class="literal-block">
body= { body= {
&quot;settings&quot; : { &quot;settings&quot; : {
&quot;index&quot; : { &quot;index&quot; : {
&quot;number_of_shards&quot; : 1, &quot;number_of_shards&quot; : 1,
&quot;number_of_replicas&quot; : 0 &quot;number_of_replicas&quot; : 0
} }
} }
} }
</pre> </pre>
<p>With this, we can create an index easily:</p> <p>With this, we can create an index easily:</p>
<p><tt class="docutils literal"><span class="pre">es.create_index(&quot;contacts&quot;,</span> <span class="pre">body=body)</span></tt></p> <p><tt class="docutils literal"><span class="pre">&gt;&gt;&gt;</span> <span class="pre">es.create_index(&quot;contacts&quot;,</span> <span class="pre">body=body)</span></tt></p>
</div> </div>
</div> </div>
</body> </body>
Expand Down

0 comments on commit a3dc9c5

Please sign in to comment.