GET http://localhost:9200/:index/:type/:id
PUT http://localhost:9200/:index/:type/(:id)
HEAD localhost:9200/:index/:type/:id
# All resources
DELETE http://localhost:9200/_all
# An index
DELETE http://localhost:9200/:index
# A type
DELETE http://localhost:9200/:index/:type
# An item
DELETE http://localhost:9200/:index/:type/:id
The hits object gives you the top 10 hits that matched the query. The score represents how well the results matched the query.
# Empty searches
# Entire database
GET http://localhost:9200/_search
# One index
GET http://localhost:9200/:index/_search
# Multuple indecies
GET http://localhost:9200/:index,:index/_search
# Wildcards
GET http://localhost:9200/hub*/_search
# Page 1
GET http://localhost:9200/_search?size=5&from=0
# Page 2
GET http://localhost:9200/_search?size=5&from=5
Good for development, not for production. If you do not specify a field, elasticsearch automatically uses the _all field, which searches through all fields.
GET /_search?q:fieldName:query
When you insert data into elastic search, it uses dynamic detection to determine what kind of data each field is.
GET http://localhost:9200/:index/:type/_mapping
- If you are adding fields, there is no need to reindex.
- If you need to change a field, you need to reindex your data. An article on the subject
Lookup more detailed information on how to do this
- Create a new index with the new mapping (see PUT mapping below)
- Pull in documents from the old index using a scrolled search and index them to the new index using the bulk API. Note: make sure that you include search_type=scan in your search request. This disables sorting and makes "deep paging" efficient.
- Update index alias.
- Delete the old index
PUT http://localhost:9200/:index/:type -d '{
"mappings": {
"tweet": {
"properties": {
…
}
}
}
}'