ES API

create index:

PUT twitter
    {
        "settings" : {
            "index" : {
                "number_of_shards" : 3, 
                "number_of_replicas" : 2 
            }
        }
    }

Mapping:

PUT test
    {
        "settings" : {
            "number_of_shards" : 1
        },
        "mappings" : {
            "type1" : {
                "properties" : {
                    "field1" : { "type" : "text" }
                }
            }
        }
    }

Aliases 类似于index的视图

PUT test
{
    "aliases" : {
        "alias_1" : {},
        "alias_2" : {
            "filter" : {
                "term" : {"user" : "kimchy" }
            },
            "routing" : "kimchy"
        }
    }
}

Wait for active shared:

{
    "acknowledged": true,
    "shards_acknowledged": true,
    "index": "test"
}
PUT test
{
    "settings": {
        "index.write.wait_for_active_shards": "2"
    }
}
PUT test?wait_for_active_shards=2
相关文章
相关标签/搜索