executable_elk-index-youtube 509 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. set -e # exit when any command fails
  3. set -x # show trace
  4. index="$1"
  5. index_create()
  6. {
  7. curl -XPUT "http://localhost:9200/$index"
  8. }
  9. index_configure()
  10. {
  11. curl -H "Content-Type: application/json" -XPUT --data-binary \
  12. '{"properties": {"upload_date": {"type": "date", "format": "yyyyMMdd"}, "title": {"type": "text", "fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}' \
  13. "http://localhost:9200/$index/_mapping/_doc"
  14. }
  15. main()
  16. {
  17. index_create
  18. index_configure
  19. }
  20. main