# return document and its related data
curl-XGET"http://localhost:9200/<index_name>/_doc/<_id>?pretty"# return document only
curl-XGET"http://localhost:9200/<index_name>/_source/<_id>?pretty"
Provides a way to perform multiple index, create, delete, and update actions in a single request.
The index and create actions expect a source on the next line.
update expects that the partial doc, upsert, and script and its options are specified on the next line.
delete does not expect a source on the next line
# Tip: Because this format uses literal `\n`'s as delimiters, make sure that the JSON actions and sources are not pretty printed
curl-XPOST"http://localhost:9200/<index_name>/_bulk?pretty"-H'Content-Type: application/json'-d'{"index": {"_id": "<document_id>"}}{"<field>": "<value>"}{"delete": {"_id": "<document_id>"}}{"create": {"_id": "<document_id>"}}{"<field>": "<value>"}{"update": {"_id": "<document_id>"}}{"doc": {"<field>": "<value>"}}'
# Tip: The `remove` action will remove this alias from other indices
curl-XPOST"http://localhost:9200/_aliases?pretty"-H'Content-Type: application/json'-d'{ "actions": [ { "remove": { "index": "*", "alias": "<alias_name>" } }, { "add": { "index": "<index_name>", "alias": "<alias_name>" } } ]}'
# One index
curl-XDELETE"http://localhost:9200/<index_name>?pretty"# Multiple indices
curl-XDELETE"http://localhost:9200/<index1>,<index2>,<index3>?pretty"# All (it needs: `action.destructive_requires_name=false`)
curl-XDELETE"http://localhost:9200/*?pretty"
# Make the source index readonly
curl-XPUT"http://localhost:9200/<source_index_name>/_settings?pretty"-H'Content-Type: application/json'-d'{ "settings": {"index.blocks.write": true}}'# Clone
curl-XPOST"http://localhost:9200/<source_index_name>/_clone/<destination_index_name>?pretty"# Make the source index write able
curl-XPUT"http://localhost:9200/<source_index_name>/_settings?pretty"-H'Content-Type: application/json'-d'{ "settings": {"index.blocks.write": false}}'
# Tip: We can't change the mapping or field type of an existing field. Changing an existing field could invalidate data that's already indexed
curl-XPUT"http://localhost:9200/<index_name>/_mapping?pretty"-H'Content-Type: application/json'-d'{ "dynamic": "<dynamic_type: strict>", "properties": { "<field>": { "type": "<data_type>" } }}'
There is no way to delete a field from mapping. Even if you delete all documents that contain this field