createIndices() {
    return client.indices.create({
        index: 'libreviews',
        body: {
          settings: {
            analysis: {
              tokenizer: {
                whitespace: {
                  type: 'whitespace'
                }
              },
              analyzer: {
                label: {
                  type: 'custom',
                  tokenizer: 'whitespace',
                  filter: ['trim', 'lowercase']
                }
              }
            }
          },
          mappings: {
            properties: {
              createdOn: {
                type: 'date'
              },
              joined: {
                type: 'join',
                relations: {
                  thing: 'review'
                }
              },
              text: search.getMultilingualTextProperties(),
              title: search.getMultilingualTextProperties(),
              urls: search.getURLProperties(),
              label: search.getMultilingualTextProperties(true),
              aliases: search.getMultilingualTextProperties(true),
              description: search.getMultilingualTextProperties(),
              type: {
                type: 'keyword'
              }
            }
          }
        }
      })
      .catch(error => {
        if (/\[index_already_exists_exception\]/.test(error.message))
          return;
        debug.error({
          error
        });
      });
  }
// If index already exists, does nothing. Logs all other errors.
If index already exists, does nothing. Logs all other errors.
If index already exists does nothing . Logs all other errors .
createIndices() {
    return client.indices.create({
        index: 'libreviews',
        body: {
          settings: {
            analysis: {
              tokenizer: {
                whitespace: {
                  type: 'whitespace'
                }
              },
              analyzer: {
                label: {
                  type: 'custom',
                  tokenizer: 'whitespace',
                  filter: ['trim', 'lowercase']
                }
              }
            }
          },
          mappings: {
            properties: {
              createdOn: {
                type: 'date'
              },
              joined: {
                type: 'join',
                relations: {
                  thing: 'review'
                }
              },
              text: search.getMultilingualTextProperties(),
              title: search.getMultilingualTextProperties(),
              urls: search.getURLProperties(),
              label: search.getMultilingualTextProperties(true),
              aliases: search.getMultilingualTextProperties(true),
              description: search.getMultilingualTextProperties(),
              type: {
                type: 'keyword'
              }
            }
          }
        }
      })
      .catch(error => {
        if (/\[index_already_exists_exception\]/.test(error.message))
          return;
        debug.error({
          error
        });
      });
  }
createIndices ( ) { return client . indices . create ( { index : 'libreviews' , body : { settings : { analysis : { tokenizer : { whitespace : { type : 'whitespace' } } , analyzer : { label : { type : 'custom' , tokenizer : 'whitespace' , filter : [ 'trim' , 'lowercase' ] } } } } , mappings : { properties : { createdOn : { type : 'date' } , joined : { type : 'join' , relations : { thing : 'review' } } , text : search . getMultilingualTextProperties ( ) , title : search . getMultilingualTextProperties ( ) , urls : search . getURLProperties ( ) , label : search . getMultilingualTextProperties ( true ) , aliases : search . getMultilingualTextProperties ( true ) , description : search . getMultilingualTextProperties ( ) , type : { type : 'keyword' } } } } } ) . catch ( error => { if ( / \[index_already_exists_exception\] / . test ( error . message ) ) return ; debug . error ( { error } ) ; } ) ; }
If index already exists, does nothing.
If index already exists does nothing .