ES : 헤드 다운로드 및 설치 플러그인 및 데이터 가져 오기

A. 헤드 다운로드 및 설치 플러그인

1.head 플러그인 다운로드

다운로드 및 플러그 헤드를 설치 데이터의 변경 사항을 확인하는 것이 더 직관적이고, 데이터에 대한 간단한 조작을 달성 할 수있다. elasticsearch5.0 버전은 다음과 elasticsearch 머리 플러그인을 설치 명령에 해당하는 디렉토리에서 직접 수행 할 수 있지만 적은 5.0 플러그 헤드의 도입 위의 단계 5.6.9을 설치, 직접 장착을 지원하지 않습니다.

다운로드 : https://github.com/mobz/elasticsearch-head

당신은 어떤 디렉토리에 압축을 풉니 다,하지만 지구 elasticsearch의 설치 디렉토리에서 분리 할 수 ​​있습니다! ! !

2.node.js 다운로드하여 직접 설치

머리 있기 때문에 Node.js를 프로젝트입니다. 따라서, 예를 들어 Node.js를의 v4.4.3 LTS (장기 지원) 버전 Node.js를 설치 nodejs를 설치할 필요는없는 경우.

볼 후 명령 "경로"를 입력, Node.js를 변수로 구성된 환경 감지 명령 라인을여
그림 삽입 설명 여기
볼 노드 버전 명령 "노드 --version"를 입력
그림 삽입 설명 여기

툴툴 거리는 소리를 설치합니다

당신이 꿀꿀 거리는 소리를 설치할 필요가 그래서 머리를 실행하면, 꿀꿀 명령을 필요로하기 때문에. 디렉토리에 Node.js를은 -g 꿀꿀 - CLI를 설치 NPM 명령을 실행 꿀꿀 거리는 소리 비트 글로벌 명령을 설치합니다.
그림 삽입 설명 여기
홈 디렉토리에 머리가 꿀꿀 거리는 소리를 설치 NPM 설치를 수행하기 위해, 설치 후 실행 꿀꿀 -version 설치가 성공하면, 그것은 설치 버전 번호가 표시됩니다 볼 완료됩니다.
그림 삽입 설명 여기

4. 헤드 구성

1) 디렉토리에 액세스 설정 설치 디렉토리, 수정 elasticsearch.yml 파일은 파일의 끝에 다음 코드를 추가합니다

http.cors.enabled: true 
http.cors.allow-origin: "*"
node.master: true
node.data: true

    
    

2) network.host : network.host에 192.168.0.1 및 참고 : 0.0.0.0] 삭제 cluster.name node.name 주석 (즉 # 제거 http.port)
. 3) 더블 elasticsearch.bat 재시작 ES
. (4) .) 호스트 이름의 해당 위치와 함께, 폴더 헤드 다운로드 된 파일 Gruntfile.js을 찾을 수 있습니다 : '*'
5) 헤드 시작 :를 명령 실행 헤드 NPM를 입력 설치 폴더 설치 또는 실행 꿀꿀 서버 NPM 후 실패 툴툴 거리는 소리를 다시 설치하는 경우, 헤드 플러그인 실행을 시작 실행합니다. 성공은 다음과 같습니다 :

Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

    
    

6) HTTP :. // localhost로 브라우저에서 : 9100 /

데이터 가져 오기 실시 5.postman

1) 인덱스 및 매핑 만들기

--put请求  localhost:9200/local_library索引名
mappings:
{
    "mappings":{
        "book":{
            "properties":{
                "book_id":{
                    "type":"long",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_code":{
                    "type":"text",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_name":{
                    "type":"text",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_price":{
                    "type":"integer",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_author":{
                    "type":"text",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_desc":{
                    "type":"text",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                }
            }
        }
    }
}

    
    

그림 삽입 설명 여기
새 우체부 데이터를 시도 할 경우, 다음과 같은 코드를 추가 할 수 있습니다

-- post请求  localhost:9200/local_library/book/1   索引/对象/id

{
"Book_id":. 1,
"book_code": "A0001",
"BOOK_NAME": "황제 진",
"book_price": 180,
"BOOK_AUTHOR": "당나라 세 개의 작은",
"book_desc는": "판타지 소설을 찾고 최고의 ! "
}

그 결과, 헤드 태그 데이터 뷰에서 보여 질 수 있고, 코드 배달부 의해 보여 질 수는 다음 동작 :

-- post请求  localhost:9200/local_library/_search?pretty
{
	"query": {
		"match": {
			"id": "1"
		}
	}
}

  
  
                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-b6c3c6d139.css" rel="stylesheet">
                                            <div class="more-toolbox">
            <div class="left-toolbox">
                <ul class="toolbox-list">
                    
                    <li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#csdnc-thumbsup"></use>
                    </svg><span class="name">点赞</span>
                    <span class="count"></span>
                    </a></li>
                    <li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-Collection-G"></use>
                    </svg><span class="name">收藏</span></a></li>
                    <li class="tool-item tool-active is-share"><a href="javascript:;"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-fenxiang"></use>
                    </svg>分享</a></li>
                    <!--打赏开始-->
                                            <!--打赏结束-->
                                            <li class="tool-item tool-more">
                        <a>
                        <svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
                        </a>
                        <ul class="more-box">
                            <li class="item"><a class="article-report">文章举报</a></li>
                        </ul>
                    </li>
                                        </ul>
            </div>
                        </div>
        <div class="person-messagebox">
            <div class="left-message"><a href="https://blog.csdn.net/weixin_44008460">
                <img src="https://profile.csdnimg.cn/5/6/2/3_weixin_44008460" class="avatar_pic" username="weixin_44008460">
                                        <img src="https://g.csdnimg.cn/static/user-reg-year/2x/1.png" class="user-years">
                                </a></div>
            <div class="middle-message">
                                    <div class="title"><span class="tit"><a href="https://blog.csdn.net/weixin_44008460" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">Make it!</a></span>
                                        </div>
                <div class="text"><span>发布了25 篇原创文章</span> · <span>获赞 6</span> · <span>访问量 2000</span></div>
            </div>
                            <div class="right-message">
                                        <a href="https://im.csdn.net/im/main.html?userName=weixin_44008460" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-letter">私信
                    </a>
                                                        <a class="btn btn-sm  bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">关注</a>
                                </div>
                        </div>
                </div>
发布了45 篇原创文章 · 获赞 0 · 访问量 3520

一. head插件下载及安装

1.head插件下载

下载安装head插件是为了更直观的看到数据的变化,并可以实现对数据的简单操作。elasticsearch5.0以下版本可以直接在elasticsearch目录下执行对应的命令安装head插件,但是5.0以上不支持直接安装,本篇介绍5.6.9以上head插件的安装步骤。

下载地址:https://github.com/mobz/elasticsearch-head

可解压到任意目录,但要与elasticsearch的安装目录区分开!!!

2.node.js下载并自行安装

因为head是一个Node.js项目。所以,如果没有安装nodejs需要先安装Node.js,以 Node.js v4.4.3 LTS(长期支持版本)版本为例。

检测环境变量中是否配置了Node.js,打开命令行输入命令"path"后可查看:
그림 삽입 설명 여기
输入命令"node --version"可查看node版本:
그림 삽입 설명 여기

3.安装grunt

당신이 꿀꿀 거리는 소리를 설치할 필요가 그래서 머리를 실행하면, 꿀꿀 명령을 필요로하기 때문에. 디렉토리에 Node.js를은 -g 꿀꿀 - CLI를 설치 NPM 명령을 실행 꿀꿀 거리는 소리 비트 글로벌 명령을 설치합니다.
그림 삽입 설명 여기
홈 디렉토리에 머리가 꿀꿀 거리는 소리를 설치 NPM 설치를 수행하기 위해, 설치 후 실행 꿀꿀 -version 설치가 성공하면, 그것은 설치 버전 번호가 표시됩니다 볼 완료됩니다.
그림 삽입 설명 여기

4. 헤드 구성

1) 디렉토리에 액세스 설정 설치 디렉토리, 수정 elasticsearch.yml 파일은 파일의 끝에 다음 코드를 추가합니다

http.cors.enabled: true 
http.cors.allow-origin: "*"
node.master: true
node.data: true

  
  

2) network.host : network.host에 192.168.0.1 및 참고 : 0.0.0.0] 삭제 cluster.name node.name 주석 (즉 # 제거 http.port)
. 3) 더블 elasticsearch.bat 재시작 ES
. (4) .) 호스트 이름의 해당 위치와 함께, 폴더 헤드 다운로드 된 파일 Gruntfile.js을 찾을 수 있습니다 : '*'
5) 헤드 시작 :를 명령 실행 헤드 NPM를 입력 설치 폴더 설치 또는 실행 꿀꿀 서버 NPM 후 실패 툴툴 거리는 소리를 다시 설치하는 경우, 헤드 플러그인 실행을 시작 실행합니다. 성공은 다음과 같습니다 :

Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

  
  

6) HTTP :. // localhost로 브라우저에서 : 9100 /

데이터 가져 오기 실시 5.postman

1) 인덱스 및 매핑 만들기

--put请求  localhost:9200/local_library索引名
mappings:
{
    "mappings":{
        "book":{
            "properties":{
                "book_id":{
                    "type":"long",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_code":{
                    "type":"text",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_name":{
                    "type":"text",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_price":{
                    "type":"integer",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_author":{
                    "type":"text",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                },
                "book_desc":{
                    "type":"text",
                    "fields":{
                        "keyword":{
                            "type":"keyword",
                            "ignore_above":256
                        }
                    }
                }
            }
        }
    }
}

  
  

그림 삽입 설명 여기
새 우체부 데이터를 시도 할 경우, 다음과 같은 코드를 추가 할 수 있습니다

-- post请求  localhost:9200/local_library/book/1   索引/对象/id

추천

출처blog.csdn.net/qq_44813090/article/details/104224108