This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | client.delete({ | |
| index: 'student', | |
| type: '_doc', | |
| id: '1' | |
| }) | |
| .then(res => console.log(JSON.stringify(res))) | |
| .catch(err => console.error(err)); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | client.search({ | |
| index: 'student', | |
| type: '_doc', | |
| body: { | |
| query: { | |
| match: { name: 'John' } | |
| } | |
| } | |
| }) | |
| .then(res => console.log(JSON.stringify(res))) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | client.update({ | |
| index: 'student', | |
| type: '_doc', | |
| id: '1', | |
| body: { | |
| doc: { | |
| hobby: 'swimming' | |
| } | |
| } | |
| }) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | client.index({ | |
| index: 'student', | |
| type: '_doc', | |
| id: 1, | |
| body: { | |
| name: 'C. Ronaldo', | |
| age: 33, | |
| hobby: 'football' | |
| } | |
| }) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | client.search({ | |
| index: 'student', | |
| type: '_doc', | |
| }) | |
| .then(res => console.log(JSON.stringify(res))) | |
| .catch(err => console.error(err)); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | client.index({ | |
| index: 'student', | |
| type: '_doc', | |
| body: { | |
| name: 'John Doe', | |
| age: 17, | |
| hobby: 'basketball' | |
| } | |
| }) | |
| .catch(err => console.error(err)); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const es = require('elasticsearch'); | |
| const client = es.Client({ host: 'http://localhost:9200' }); | |
| client.ping() | |
| .then(res => console.log('connection success', res)) | |
| .catch(err => console.error('wrong connection', err)); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | --- | |
| version: "3" | |
| services: | |
| elasticsearch: | |
| image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4 | |
| environment: | |
| - cluster.name=docker-cluster | |
| - bootstrap.memory_lock=true | |
| - "ES_JAVA_OPTS=-Xms512m -Xmx512m" | |
| ulimits: | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | FROM node:6.11.1 | |
| # Copy package.json and package-lock.json | |
| COPY package.json . | |
| COPY package-lock.json . | |
| RUN npm install --quiet | |
| COPY . . | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var scores = [1, 2, 3, 4]; | |
| function multiplyTwo(score) { | |
| return score * 2; | |
| } | |
| var result = scores.map(multiplyTwo); | 
NewerOlder