ElasticSearch Index API & Mapping, elasticsearchapi
ElasticSearch NEST Client operation Index
Var indexName = "twitter ";
Var deleteIndexResponse = client. DeleteIndex (indexName );
Var createIndexResponse = client. CreateIndex (indexName );
Var getIndexResponse = client. GetIndex (indexName );
Var indexExistsResponse = client. IndexExists (indexName );
Var openIndexResponse = client. OpenIndex (indexName );
Var closeIndexResponse = client. CloseIndex (indexName );
1. Create an Index
PUT twitter{}
2. Delete Index
DELETE /twitter
3. Get Index
GET /twitter
4. Check whether an Index exists.
HEAD twitter
5. Enable and disable Index
POST /twitter/_closePOST /twitter/_open
PUT mapping
1. Create an Index and add Mapping to the field
PUT twitter { "mappings": { "tweet": { "properties": { "message": { "type": "text" } } } }}
2. Add the document type to the existing Index and specify Mapping
PUT twitter/_mapping/user { "properties": { "name": { "type": "text" } }}
3. Add a new field Mapping to an existing Mapping.
PUT twitter/_mapping/tweet { "properties": { "user_name": { "type": "text" } }}
Note: In general, the existing field Mapping cannot be modified.
Get Mapping API
Obtain the Mapping information of the entire document.
GET /twitter/_mapping/tweet
Get Field Mapping API
Obtains the ing information of a specified field.
GET publications/_mapping/article/field/title