# ESView **Repository Path**: randory/ESView ## Basic Information - **Project Name**: ESView - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-02-01 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # esview > A Vue.js project ## Build Setup ``` bash # install dependencies npm install # serve with hot reload at localhost:8080 npm run dev # build for production with minification npm run build # build for production and view the bundle analyzer report npm run build --report # run unit tests npm run unit # run all tests npm test ``` For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). # 安装Elasticsearch (v6.1.3) 下载地址 https://www.elastic.co/downloads/elasticsearch # 运行Elasticsearch ``` ./bin/elasticsearch ``` 如果想在后台以守护进程模式运行,添加-d参数。 ``` ./bin/elasticsearch -d ``` # 使用RESTful API 在elasticsearch.yml中添加以下内容,开启跨域支持: ``` #开启跨域访问支持,默认为false http.cors.enabled: true #跨域访问允许的域名地址,(允许所有域名)以上使用正则 http.cors.allow-origin: /.*/ ``` ``` GET http://localhost:9200/?pretty ``` Response: ``` { "name": "j8nem8V", "cluster_name": "elasticsearch", "cluster_uuid": "1yyv7_WfSTaUewopZJSvXQ", "version": { "number": "6.1.3", "build_hash": "af51318", "build_date": "2018-01-26T18:22:55.523Z", "build_snapshot": false, "lucene_version": "7.1.0", "minimum_wire_compatibility_version": "5.6.0", "minimum_index_compatibility_version": "5.0.0" }, "tagline": "You Know, for Search" } ``` # 计算集群中的文档数量 ``` POST http://localhost:9200/?pretty // Body { "query": { "match_all": {} } } ``` Response: ``` { "count": 0, "_shards": { "total": 0, "successful": 0, "skipped": 0, "failed": 0 } } ``` # 添加一个文档 ``` PUT http://localhost:9200/megacorp/employee/1 // megacorp 索引 // employee 类型 // 1 id // Body { "first_name" : "John", "last_name" : "Smith", "age" : 25, "about" : "I love to go rock climbing", "interests": [ "sports", "music" ] } ``` Response: ``` { "_index": "megacorp", "_type": "employee", "_id": "1", "_version": 1, "result": "created", "_shards": { "total": 2, "successful": 1, "failed": 0 }, "_seq_no": 0, "_primary_term": 1 } ``` 在Elasticsearch中,文档归属于一种类型(type),而这些类型存在于索引(index)中,我们可以画一些简单的对比图来类比传统关系型数据库: ``` Relational DB -> Databases -> Tables -> Rows -> Columns Elasticsearch -> Indices -> Types -> Documents -> Fields ``` 以上内容来源:https://es.xiaoleilu.com/010_Intro/00_README.html