Changes between Version 7 and Version 8 of ELK


Ignore:
Timestamp:
05/11/21 16:36:51 (4 years ago)
Author:
krit
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ELK

    v7 v8  
    8989curl -X POST -H "Content-Type: application/json" http://127.0.0.1:9200/mjson-2021-02-09/_doc/_delete_by_query -d '{"query":{"range":{"@timestamp":{"from":"2021-02-08T00:00:00","to":"2021-02-09T23:59:59" }}}}'
    9090}}}
     91
     92
     93Directly manage to ES
     94{{{
     95
     96curl -H "Content-Type: application/json" -XPOST "http://localhost:9200/test1/_doc" -d "{ \"id\" : 1}"
     97curl -H "Content-Type: application/json" -XPOST "http://localhost:9200/test2/_doc" -d "{ \"id\" : 2}"
     98
     99curl -X GET http://127.0.0.1:9200/test1/_doc/_search?pretty
     100
     101# alias add with
     102# 1st method
     103curl -X POST "localhost:9200/_aliases?pretty" -H 'Content-Type: application/json' -d'
     104{
     105    "actions" : [
     106        { "add" : { "indices" : ["test1", "test2"], "alias" : "test" } }
     107    ]
     108}'
     109 
     110# 2nd method
     111curl -X POST "localhost:9200/_aliases?pretty" -H 'Content-Type: application/json' -d'
     112{
     113    "actions" : [
     114        { "add" : { "index" : "test1", "alias" : "alias1" } },
     115        { "add" : { "index" : "test2", "alias" : "alias1" } }
     116    ]
     117}'
     118
     119# remove test2 from alias test
     120curl -X POST "localhost:9200/_aliases?pretty" -H 'Content-Type: application/json' -d'
     121{
     122    "actions" : [
     123        { "remove" : { "index" : "test2", "alias" : "test" } }
     124    ]
     125}'
     126
     127# remove test1 from alias test and add test2 to alias test
     128curl -X POST "localhost:9200/_aliases?pretty" -H 'Content-Type: application/json' -d'
     129{
     130    "actions" : [
     131        { "remove" : { "index" : "test1", "alias" : "test" } },
     132        { "add" : { "index" : "test2", "alias" : "test" } }
     133    ]
     134}'
     135
     136
     137curl -X GET localhost:9200/_cat/indices
     138
     139#Once you have deleted your index, the alias will also get deleted.
     140#In your case, you can directly delete test1 and test2.
     141}}}