importJSONMapping()

in common-utils/network/test-fixture-handler.js [12:29]


  importJSONMapping(filename) {
    const parseIndex = ({ index, settings, mappings, aliases }) => {
    return { index, body: { settings, mappings, aliases } }
    }

    this.testRunner.readFile(filename, 'utf8').then((str) => {
      const strSplit = str.split('\n\n')
      strSplit.forEach((element) => {
        const json = JSON.parse(element)
        if (json.type === 'index') {
          const indexContent = parseIndex(json.value)
          this.testRunner.request({ method: 'PUT', url: `${this.openSearchUrl}/${indexContent.index}`, body: indexContent.body, failOnStatusCode: false }).then((response) => {
  
          })
        }
      })
    })
  }