11[[indices-create-index]]
22== Create Index
33
4- The create index API allows to instantiate an index. Elasticsearch
5- provides support for multiple indices, including executing operations
6- across several indices.
4+ The Create Index API is used to manually create an index in Elasticsearch. All documents in Elasticsearch
5+ are stored inside of one index or another.
6+
7+ The most basic command is the following:
8+
9+ [source,js]
10+ --------------------------------------------------
11+ PUT twitter
12+ --------------------------------------------------
13+ // CONSOLE
14+
15+ This create an index named `twitter` with all default setting.
16+
17+ [NOTE]
18+ .Index name limitations
19+ ======================================================
20+ There are several limitations to what you can name your index. The complete list of limitations are:
21+
22+ - Lowercase only
23+ - Cannot include `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, ` ` (space character), `,`, `#`
24+ - Indices prior to 7.0 could contain a colon (`:`), but that's been deprecated and won't be supported in 7.0+
25+ - Cannot start with `-`, `_`, `+`
26+ - Cannot be `.` or ``..`
27+ - Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters will count towards the 255 limit faster)
28+
29+ ======================================================
730
831[float]
932[[create-index-settings]]
1033=== Index Settings
1134
1235Each index created can have specific settings
13- associated with it.
36+ associated with it, defined in the body:
1437
1538[source,js]
1639--------------------------------------------------
@@ -28,25 +51,6 @@ PUT twitter
2851<1> Default for `number_of_shards` is 5
2952<2> Default for `number_of_replicas` is 1 (ie one replica for each primary shard)
3053
31- The above second curl example shows how an index called `twitter` can be
32- created with specific settings for it using http://www.yaml.org[YAML].
33- In this case, creating an index with 3 shards, each with 2 replicas. The
34- index settings can also be defined with http://www.json.org[JSON]:
35-
36- [source,js]
37- --------------------------------------------------
38- PUT twitter
39- {
40- "settings" : {
41- "index" : {
42- "number_of_shards" : 3,
43- "number_of_replicas" : 2
44- }
45- }
46- }
47- --------------------------------------------------
48- // CONSOLE
49-
5054or more simplified
5155
5256[source,js]
0 commit comments