This API creates a new index.
PUT /v1/indexes/<INDEX_NAME>
<INDEX_NAME>
: (Required, string) Name of the index you want to create.
{
"index_uri": <INDEX_URI>,
"lock_uri": <LOCK_URI>,
"index_mapping": {
<INDEX_MAPPING>
},
"num_shards": <NUM_SHARDS>,
"default_search_field": <DEFAULT_SEARCH_FIELD>,
"default_analyzer": {
<DEFAULT_ANALYZER>
}
}
-
<INDEX_URI>
: (Required, string) Path of the index.
See Lock store section. -
<LOCK_URI>
: (Optional, string) Path of the lock objects.
See Lock store section. -
<INDEX_MAPPING>
: (Required, JSON) Mapping for fields in the index.
See Index Mapping section. -
<NUM_SHARDS>
: (Optional, integer) Number of shards in the index.
Defaults to 1. -
<DEFAULT_SEARCH_FIELD>
: (Optional, string) Default search field in the index.
Defaults to_all
. -
<DEFAULT_ANALYZER>
: (Optional, JSON) Default analyuzer to use in the index.
See Analyzer section. Defaults to use StandardAnalyzer that will be the same as the next setting.
{
"tokenizer": {
"name": "unicode"
},
"token_filters": [
{
"name": "lower_case"
}
]
}
% curl -XPUT -H 'Content-type: application/json' http://localhost:8000/v1/indexes/example --data-binary '
{
"index_uri": "file:///tmp/phalanx-indexes/example",
"index_mapping": {
"id": {
"type": "numeric",
"options": {
"index": true,
"store": true,
"sortable": true,
"aggregatable": true
}
},
"text": {
"type": "text",
"options": {
"index": true,
"store": true,
"term_positions": true,
"highlight": true,
"sortable": true,
"aggregatable": true
},
"analyzer": {
"char_filters": [
{
"name": "ascii_folding"
},
{
"name": "unicode_normalize",
"options": {
"form": "NFKC"
}
}
],
"tokenizer": {
"name": "unicode"
},
"token_filters": [
{
"name": "lower_case"
}
]
}
}
},
"num_shards": 1,
"default_search_field": "_all",
"default_analyzer": {
"tokenizer": {
"name": "unicode"
},
"token_filters": [
{
"name": "lower_case"
}
]
}
}
'