[source, ruby]
----
response = client.ml.preview_datafeed(
  body: {
    datafeed_config: {
      indices: [
        'kibana_sample_data_ecommerce'
      ],
      query: {
        bool: {
          filter: [
            {
              term: {
                _index: 'kibana_sample_data_ecommerce'
              }
            }
          ]
        }
      },
      scroll_size: 1000
    },
    job_config: {
      description: 'Find customers spending an unusually high amount in an hour',
      analysis_config: {
        bucket_span: '1h',
        detectors: [
          {
            detector_description: 'High total sales',
            function: 'high_sum',
            field_name: 'taxful_total_price',
            over_field_name: 'customer_full_name.keyword'
          }
        ],
        influencers: [
          'customer_full_name.keyword',
          'category.keyword'
        ]
      },
      analysis_limits: {
        model_memory_limit: '10mb'
      },
      data_description: {
        time_field: 'order_date',
        time_format: 'epoch_ms'
      }
    }
  }
)
puts response
----
