ElasticSearch Index API & amp; Mapping, elasticsearchapi

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.