[docs] Modernize README.textile
* camel_case all the things * `?pretty` all the things (we tell people to do this in bug reports) Closes #18136
This commit is contained in:
parent
223d67df4a
commit
fad0705e30
|
@ -50,19 +50,19 @@ h3. Indexing
|
|||
Let's try and index some twitter like information. First, let's create a twitter user, and add some tweets (the @twitter@ index will be created automatically):
|
||||
|
||||
<pre>
|
||||
curl -XPUT 'http://localhost:9200/twitter/user/kimchy' -d '{ "name" : "Shay Banon" }'
|
||||
curl -XPUT 'http://localhost:9200/twitter/user/kimchy?pretty' -d '{ "name" : "Shay Banon" }'
|
||||
|
||||
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '
|
||||
curl -XPUT 'http://localhost:9200/twitter/tweet/1?pretty' -d '
|
||||
{
|
||||
"user": "kimchy",
|
||||
"postDate": "2009-11-15T13:12:00",
|
||||
"post_date": "2009-11-15T13:12:00",
|
||||
"message": "Trying out Elasticsearch, so far so good?"
|
||||
}'
|
||||
|
||||
curl -XPUT 'http://localhost:9200/twitter/tweet/2' -d '
|
||||
curl -XPUT 'http://localhost:9200/twitter/tweet/2?pretty' -d '
|
||||
{
|
||||
"user": "kimchy",
|
||||
"postDate": "2009-11-15T14:12:12",
|
||||
"post_date": "2009-11-15T14:12:12",
|
||||
"message": "Another tweet, will it be indexed?"
|
||||
}'
|
||||
</pre>
|
||||
|
@ -101,7 +101,7 @@ Just for kicks, let's get all the documents stored (we should see the user as we
|
|||
curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -d '
|
||||
{
|
||||
"query" : {
|
||||
"matchAll" : {}
|
||||
"match_all" : {}
|
||||
}
|
||||
}'
|
||||
</pre>
|
||||
|
@ -113,7 +113,7 @@ curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -d '
|
|||
{
|
||||
"query" : {
|
||||
"range" : {
|
||||
"postDate" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:00:00" }
|
||||
"post_date" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:00:00" }
|
||||
}
|
||||
}
|
||||
}'
|
||||
|
@ -130,19 +130,19 @@ Elasticsearch supports multiple indices, as well as multiple types per index. In
|
|||
Another way to define our simple twitter system is to have a different index per user (note, though that each index has an overhead). Here is the indexing curl's in this case:
|
||||
|
||||
<pre>
|
||||
curl -XPUT 'http://localhost:9200/kimchy/info/1' -d '{ "name" : "Shay Banon" }'
|
||||
curl -XPUT 'http://localhost:9200/kimchy/info/1?pretty' -d '{ "name" : "Shay Banon" }'
|
||||
|
||||
curl -XPUT 'http://localhost:9200/kimchy/tweet/1' -d '
|
||||
curl -XPUT 'http://localhost:9200/kimchy/tweet/1?pretty' -d '
|
||||
{
|
||||
"user": "kimchy",
|
||||
"postDate": "2009-11-15T13:12:00",
|
||||
"post_date": "2009-11-15T13:12:00",
|
||||
"message": "Trying out Elasticsearch, so far so good?"
|
||||
}'
|
||||
|
||||
curl -XPUT 'http://localhost:9200/kimchy/tweet/2' -d '
|
||||
curl -XPUT 'http://localhost:9200/kimchy/tweet/2?pretty' -d '
|
||||
{
|
||||
"user": "kimchy",
|
||||
"postDate": "2009-11-15T14:12:12",
|
||||
"post_date": "2009-11-15T14:12:12",
|
||||
"message": "Another tweet, will it be indexed?"
|
||||
}'
|
||||
</pre>
|
||||
|
@ -152,11 +152,11 @@ The above will index information into the @kimchy@ index, with two types, @info@
|
|||
Complete control on the index level is allowed. As an example, in the above case, we would want to change from the default 5 shards with 1 replica per index, to only 1 shard with 1 replica per index (== per twitter user). Here is how this can be done (the configuration can be in yaml as well):
|
||||
|
||||
<pre>
|
||||
curl -XPUT http://localhost:9200/another_user/ -d '
|
||||
curl -XPUT http://localhost:9200/another_user?pretty -d '
|
||||
{
|
||||
"index" : {
|
||||
"numberOfShards" : 1,
|
||||
"numberOfReplicas" : 1
|
||||
"number_of_shards" : 1,
|
||||
"number_of_replicas" : 1
|
||||
}
|
||||
}'
|
||||
</pre>
|
||||
|
@ -168,7 +168,7 @@ index (twitter user), for example:
|
|||
curl -XGET 'http://localhost:9200/kimchy,another_user/_search?pretty=true' -d '
|
||||
{
|
||||
"query" : {
|
||||
"matchAll" : {}
|
||||
"match_all" : {}
|
||||
}
|
||||
}'
|
||||
</pre>
|
||||
|
@ -179,7 +179,7 @@ Or on all the indices:
|
|||
curl -XGET 'http://localhost:9200/_search?pretty=true' -d '
|
||||
{
|
||||
"query" : {
|
||||
"matchAll" : {}
|
||||
"match_all" : {}
|
||||
}
|
||||
}'
|
||||
</pre>
|
||||
|
|
Loading…
Reference in New Issue