[source, ruby]
----
response = client.indices.create(
  index: 'test',
  body: {
    settings: {
      analysis: {
        filter: {
          email: {
            type: 'pattern_capture',
            preserve_original: true,
            patterns: [
              '([^@]+)',
              '(\\p{L}+)',
              '(\\d+)',
              '@(.+)'
            ]
          }
        },
        analyzer: {
          email: {
            tokenizer: 'uax_url_email',
            filter: [
              'email',
              'lowercase',
              'unique'
            ]
          }
        }
      }
    }
  }
)
puts response
----
