Elasticsearch - Basic Operation

Create a new index

PUT <index_name>

Get the details of all indexes

GET _cat/indices?v

Delete Index

DELETE <index_name>

Add Mappings

Add mappings to index eccommerce Expand source

Check the mappings/Settings of an Index

GET eccommerce/_mappings

GET eccommerce/_settings

Add Documents to an Index

PUT eccommerce/product/1002

{

  "name""Iphone 7",

  "price""6k",

  "description""Released in 2016",

  "status""none",

  "quantity": 200,

  "categories": [

    {

      "name""smart phone"

    }

  ],

  "tags": [

    "daily goods",

    "smart",

    "expensive"

  ]

}

We can find the details of product 1002:

Update Documents

POST eccommerce/product/1001/_update

{

  "doc": {

    "price": 7000

  }

}

Delete Documents

DELETE eccommerce/product/1001

Batch Processing 

Search Ways

Search for all documents in the type

GET eccommerce/product/_search

GET eccommerce/product/_search?q=name:Iphone 7

Search according to some conditions

GET eccommerce/product/_search?q=name:Iphone

猜你喜欢

转载自blog.csdn.net/bettyHHUC/article/details/89705701