1. ElasticSearch파일- bin - elasticsearch.bat 실행

2. kibana파일 - bin - kibana.bat 실행 - http://localhost:5601

3. logstash파일 - bin - logstash -f "C:\logstash-7.6.0\logstash-7.6.0\config\test2.conf

 

 

ELASTIC SEARCH명령어 윈도우용 - json 파일 업로드


curl -XPUT "http://localhost:9200/blog/user/dilbert" -H "Content-Type: application/json" -d "{ ""name"" : ""Dilbert Brown""}"" 
curl -XGET http://localhost:9200/blog?pretty 

curl -XPUT "http://localhost:9200/classes/class/1" -H "Content-Type: application/json" -d "{ ""title"" : ""Algorithm"",""professor"":""John""}" 
//document 추가 + 확인 
curl -XPOST "http://localhost:9200/classes/class/1" -H "Content-Type: application/json" _update -d "{ ""doc"" : {""unit"":1}}" 
curl -XGET http://localhost:9200/classes/class/1?pretty 
curl -XPOST "http://localhost:9200/classes/class/1" -H "Content-Type: application/json" _update -d "{ ""doc"" : {""unit"":2}}" 
//또다른방법  
curl -XPOST "http://localhost:9200/classes/class/1" -H "Content-Type: application/json" _update -d "{ ""script"" : ""ctx._source.unit+=5""}" 
//bulk파일 
curl -s -XPOST "http://localhost:9200/_bulk" -H "Content-Type: application/json" --data-binary @classes.json 
curl -XGET http://localhost:9200/classes?pretty 
//mapping ->이방식은 이미 생성된 index에 대한 내장필드를 설정하는방법이다. 
curl -XPUT "http://localhost:9200/yoonseo/class/_mapping?include_type_name=true" -d @classesRating_mapping.json -H "Content-Type: application/json" 
curl -XGET http://localhost:9200/yoonseo?pretty 
//데이터 넣어줌 
curl -XPOST "http://localhost:9200/yoonseo/_bulk"?pretty -H "Content-Type: application/json" --data-binary @classes.json 
curl -XGET http://localhost:9200/yoonseo/class/3?pretty 
//search 
curl -s -XPOST "http://localhost:9200/_bulk" -H "Content-Type: application/json" --data-binary @simple_basketball.json 
curl -XGET http://localhost:9200/basketball/record/_search?pretty 
검색1 
curl -XGET "localhost:9200/basketball/record/_search?q=points:30&pretty" 
검색2 //error 
curl -XGET "localhost:9200/basketball/record/_search -d" 
{   
   "query":{   
      "term":{ "points":30} 
   } 
}" 
//aggregation 
curl -XPOST "http://localhost:9200/_search"?pretty -H "Content-Type: application/json" --data-binary @avg_points_aggs.json 
curl -XPOST "http://localhost:9200/_search"?pretty -H "Content-Type: application/json" --data-binary @max_points_aggs.json 
curl -XPOST "http://localhost:9200/_search"?pretty -H "Content-Type: application/json" --data-binary @stats_points_aggs.json 

//bulk_aggregaion (basket지우고다시) 
curl -XPUT localhost:9200/basketball  
curl -XPUT "http://localhost:9200/basketball/record/_mapping?include_type_name=true" -d @basketball_mapping.json -H "Content-Type: application/json" 
curl -s -XPOST "http://localhost:9200/_bulk" --data-binary @bulk_basketball.json -H "Content-Type: application/json"  
curl -XGET http://localhost:9200/basketball/record/_search?pretty 
curl -XGET "http://localhost:9200/_search"?pretty -H "Content-Type: application/json" --data-binary @terms_aggs.json #에러 
curl -XGET "http://localhost:9200/_search"?pretty -H "Content-Type: application/json" --data-binary @stats_points_aggs.json 
curl -XGET "http://localhost:9200/_search?pretty --data-binary @terms_aggs.json 

curl -s -XPOST "http://localhost:9200/_bulk" -H "Content-Type: application/json" --data-binary @bulk_basketball.json 
curl -s -XPOST "http://localhost:9200/_bulk" -H "Content-Type: application/json" --data-binary @classes.json 

curl -X POST -H "Content-Type: application/x-ndjson" localhost:9200/_bulk --data-binary "@bulk_basketball.json" 
 
   "size": 0, 
   "aggs": { // 집계  
      "my_aggs": { // 집계 명 (사용자 정의) 
         "{metric_arrgs_type}": { // 집계 타입  
            "field": "{file_name}" // 집계 대상 필드 
             "order" : { "{field_name}" : "desc" } // 정렬 
         } 
      } 
   } 
}  //매트릭집계구조 GET /{index_name}/_search?pretty 

 

logstash -  대량 csv파일 업로드용

 

---> 에러 발생시 logstash - logs안에 있는 제일 최근 텍스트 열어서 확인하기

 

 

 

아래 참조

 

ELK 스택 (ElasticSearch, Logstash, Kibana) 으로 데이터 분석 - 인프런

ElasticSearch, LogStash, Kibana 기초부터 설명합니다. 최종단계로 ELK 스택을 활용하여, 세계 인구 분석, 주식 분석을 하시는 본인의 모습을 발견하실 수 있습니다. 초급 중급 데이터 분석 Elasticsearch Logstash Kibana 온라인 강의 ELK 스택

www.inflearn.com

 

+ Recent posts