PUT Mappings
create index with mappings
curl -X PUT "localhost:9200/twitter?pretty" -H 'Content-Type: application/json' -d'
{}'
curl -X PUT "localhost:9200/twitter/_mapping/_doc?pretty" -H 'Content-Type: application/json' -d'
{
"properties": {
"email": {
"type": "keyword"
}
}
}'
update existing index
curl -X PUT "localhost:9200/my_index?pretty" -H 'Content-Type: application/json' -d'
{
"mappings": {
"_doc": {
"properties": {
"name": {
"properties": {
"first": {
"type": "text"
}
}
},
"user_id": {
"type": "keyword"
}
}
}
}
}'
curl -X PUT "localhost:9200/my_index/_mapping/_doc?pretty" -H 'Content-Type: application/json' -d'
{
"properties": {
"name": {
"properties": {
"last": {
"type": "text"
}
}
},
"user_id": {
"type": "keyword",
"ignore_above": 100
}
}
}'
Get Mappings
curl -X GET "localhost:9200/twitter/_mapping/_doc?pretty"
GET field mapping
curl -X GET "localhost:9200/publications/_mapping/_doc/field/title?pretty"
Top comments (0)