PUT /my_index
{
"settings": { ... any settings ... },
"mappings": {
"type_one": { ... any mappings ... },
"type_two": { ... any mappings ... },
...
}
action.auto_create_index: false
DELETE /my_index
DELETE /index_one,index_two
DELETE /index_*
DELETE /_all
5
。这个配置在索引创建后不能修改。1
。这个配置可以随时在活跃的索引上修改。PUT /my_temp_index
{
"settings": {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
PUT /my_temp_index/_settings
{
"number_of_replicas": 1
}
PUT /spanish_docs
{
"settings": {
"analysis": {
"analyzer": {
"es_std": {
"type": "standard",
"stopwords": "_spanish_"
}
}
}
}
}
PUT /my_index
{
"settings": {
"analysis": {
"char_filter": { ... custom character filters ... },
"tokenizer": { ... custom tokenizers ... },
"filter": { ... custom token filters ... },
"analyzer": { ... custom analyzers ... }
}
}
}
"char_filter": { "&_to_and": { "type": "mapping", "mappings": [ "&=> and "] } }
"filter": { "my_stopwords": { "type": "stop", "stopwords": [ "the", "a" ] } }
"analyzer": { "my_analyzer": { "type": "custom", "char_filter": [ "html_strip", "&_to_and" ], "tokenizer": "standard", "filter": [ "lowercase", "my_stopwords" ] } }
PUT /my_index { "settings": { "analysis": { "char_filter": { "&_to_and": { "type": "mapping", "mappings": [ "&=> and "] }}, "filter": { "my_stopwords": { "type": "stop", "stopwords": [ "the", "a" ] }}, "analyzer": { "my_analyzer": { "type": "custom", "char_filter": [ "html_strip", "&_to_and" ], "tokenizer": "standard", "filter": [ "lowercase", "my_stopwords" ] }} }}}
GET /my_index/_analyze { "analyzer": "my_analyzer", "text":"The quick & brown fox" }
GET /my_index/_analyze?analyzer=my_analyzer The quick & brown fox
{ "tokens": [ { "token": "quick", "start_offset": 4, "end_offset": 9, "type": "<ALPHANUM>", "position": 1 }, { "token": "and", "start_offset": 10, "end_offset": 11, "type": "<ALPHANUM>", "position": 2 }, { "token": "brown", "start_offset": 12, "end_offset": 17, "type": "<ALPHANUM>", "position": 3 }, { "token": "fox", "start_offset": 18, "end_offset": 21, "type": "<ALPHANUM>", "position": 4 } ] } ## 元数据:_source 字段
GET /_search
{
"query": { "match_all": {}},
"_source": [ "title", "created" ]
}
PUT /my_index/_mapping/my_type { "my_type": { "_all": { "enabled": false } } } 默认映射
PUT /my_index
{
"mappings": {
"_default_": {
"_all": { "enabled": false }
},
"blog": {
"_all": { "enabled": true }
}
}
}