GET http://localhost:9200/:index/_analyze?analyzer=default&text=test+text
-
-
Save d68fbe50/ec8341ae82d09edf345cb57e05e55707 to your computer and use it in GitHub Desktop.
ElasticSearch cheat cheat
GET http://localhost:9200/:index/:type/:id
PUT http://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
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
- 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": {
…
}
}
}
}'
The hits object gives you the top 10 hits that matched the query. The score represents how well the results matched the query.
# 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment