更新索引对应的 mapping

PUT /es/:target/_mapping

请求示例

PUT http://localhost:4080/es/olympics/_mapping

请求体:

  1. {
  2. "properties": {
  3. "name": {
  4. "type": "text",
  5. "index": true,
  6. "store": true,
  7. "sortable": false,
  8. "aggregatable": false,
  9. "highlightable": true
  10. },
  11. "author": {
  12. "type": "keyword",
  13. "index": true,
  14. "store": false,
  15. "sortable": true,
  16. "aggregatable": true,
  17. "highlightable": false
  18. },
  19. "price": {
  20. "type": "numeric",
  21. "index": true,
  22. "store": false,
  23. "sortable": true,
  24. "aggregatable": true,
  25. "highlightable": false
  26. },
  27. "published": {
  28. "type": "bool",
  29. "index": true,
  30. "store": false,
  31. "sortable": true,
  32. "aggregatable": true,
  33. "highlightable": false
  34. },
  35. "create_at": {
  36. "type": "date",
  37. "format": "2006-01-02T15:04:05Z07:00",
  38. "index": true,
  39. "store": false,
  40. "sortable": true,
  41. "aggregatable": true,
  42. "highlightable": false
  43. }
  44. }
  45. }

mapping 也能在创建索引的时候指定