Mapping Exercise
sudo service elasticsearch startcurl localhost:9200curl -XPOST localhost:9200/orders/orders/1 \ -H 'content-type: application/json' \ -d ' { "id": "1", "placedOn": "2016-10-17T13:03:30.830Z" }'curl 'localhost:9200/orders/orders/_mapping?pretty=true'{ "orders" : { "mappings" : { "orders" : { "properties" : { "id" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "placedOn" : { "type" : "date" } } } } } }curl -XPUT 'localhost:9200/orders/_mapping?pretty=true' \ -H 'content-type: application/json' \ -d ' { "orders" : { "mappings" : { "orders" : { "properties" : { "id" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "placedOn" : { "type" : "date", "format" : "strict_date_optional_time||epoch_millis" } } } } } }'curl -XPUT 'localhost:9200/orders/orders/_mapping?pretty=mapping' \ -H 'content-type: application/json' \ -d '{ "orders" : { "mappings" : { "orders" : { "properties" : { "id" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "placedOn" : { "type" : "date", "format" : "strict_date_optional_time||epoch_millis" } } } } } }'curl -XPUT 'localhost:9200/orders/orders/_mapping?pretty=mapping' \ -H 'content-type: application/json' \ -d ' { "orders" : { "properties" : { "id" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "placedOn" : { "type" : "date", "format" : "strict_date_optional_time||epoch_millis" } } } }'curl -XPUT 'localhost:9200/orders/orders/_mapping?pretty=true' \ -H 'content-type: application/json' -d ' { "orders" : { "properties" : { "id" : { "type" : "double" }, "placedOn" : { "type" : "date", "format" : "strict_date_optional_time||epoch_millis" } } } }'curl -XDELETE localhost:9200/orders curl -XPUT localhost:9200/orders{ "acknowledged": true }
Last updated