Enterprise Search management APIs

edit

Enterprise Search management APIsedit

Use the Enterprise Search APIs to manage your Enterprise Search deployment(s).

To make a request to the Management APIs, use the enterprise property of the client object, followed by the desired method.

Refer to the Enterprise Search management APIs documentation for more information on the available APIs.

On this page:

Health APIedit

Refer to the full API documentation for the Health and Stats API.

To get the health of an Enterprise Search instance, use the getHealth method:

async function run() {
  const health = await client.enterprise.getHealth()
  if (health.errors) {
    console.log(health)
    return
  }
  console.log(health)
}

run().catch(console.error)
Expand to see an example response
{
  name: '95c8e93f2cfe',
  version: {
    number: '8.6.0',
    build_hash: 'd5faad259c946d259f84a1aaebcf6fcec1464454',
    build_date: '2022-12-05T18:37:28+00:00'
  },
  jvm: {
    gc: {
      collection_count: 15,
      collection_time: 678,
      garbage_collectors: [Object]
    },
    pid: 20,
    uptime: 1268871,
    memory_usage: {
      heap_init: 6442450944,
      heap_used: 723603408,
      heap_committed: 6442450944,
      heap_max: 6442450944,
      object_pending_finalization_count: 0,
      non_heap_init: 7667712,
      non_heap_committed: 286724096
    },
    memory_pools: [
      "CodeHeap 'non-nmethods'",
      'Metaspace',
      "CodeHeap 'profiled nmethods'",
      'Compressed Class Space',
      'G1 Eden Space',
      'G1 Old Gen',
      'G1 Survivor Space',
      "CodeHeap 'non-profiled nmethods'"
    ],
    threads: {
      thread_count: 42,
      peak_thread_count: 44,
      total_started_thread_count: 77,
      daemon_thread_count: 20
    },
    vm_version: '11.0.17+8',
    vm_vendor: 'Eclipse Adoptium',
    vm_name: 'OpenJDK 64-Bit Server VM'
  },
  filebeat: {
    pid: 215,
    alive: true,
    restart_count: 0,
    seconds_since_last_restart: -1
  },
  metricbeat: { alive: false },
  esqueues_me: {},
  crawler: {
    running: true,
    workers: { pool_size: 64, active: 0, available: 64 }
  },
  system: {
    java_version: '11.0.17',
    jruby_version: '9.3.3.0',
    os_name: 'Linux',
    os_version: '5.4.0-1049-gcp'
  },
  cluster_uuid: 'cChsNC2cTkyO149k-TJR7g'
}

Version APIedit

The version API responds with a subset of the Health API.

To get the version of an Enterprise Search instance, use the getVersion method:

async function run() {
  const version = await client.enterprise.getVersion()
  if (version.errors) {
    console.log(version)
    return
  }
  console.log(version)
}

run().catch(console.error)

A successful response looks like this:

{
  number: '8.6.0',
  build_hash: 'd5faad259c946d259f84a1aaebcf6fcec1464454',
  build_date: '2022-12-05T18:37:28+00:00'
}

Read-only flag management APIedit

The Enterprise Search read-only flag is a feature that allows you to prevent write operations to your Enterprise Search instance.

Refer to the full API reference for more details.

To check the read-only status, use the getReadOnly method:

async function run() {
  const readOnly = await client.enterprise.getReadOnly(true)
  if (readOnly.errors) {
    console.log(readOnly)
    return
  }
  console.log(readOnly)
}

run().catch(console.error)

To update the read-only status, use the putReadOnly method, passing in an object with the enabled property:

async function run() {
  const readOnly = await client.enterprise.putReadOnly({enabled: true})
  if (readOnly.errors) {
    console.log(readOnly)
    return
  }
  console.log(readOnly)
}

run().catch(console.error)

Deployment Stats APIedit

To get information about the storage used by Enterprise Search, use the getStorage method:

async function run() {
  const stats = await client.enterprise.getStats()
  if (stats.errors) {
    console.log(stats)
    return
  }
  console.log(stats)
}

run().catch(console.error)
Expand to see an example response
{
  cluster_uuid: 'cChsNC2cTkyO149k-TJR7g',
  http: {
    connections: { current: 8, max: 44, total: 3426 },
    request_duration_ms: {
      max: 447031874,
      mean: 292844.8964306612,
      std_dev: 2969218.4216408036
    },
    network_bytes: {
      received_total: 27490033,
      received_rate: 0,
      sent_total: 155114154,
      sent_rate: 0
    },
    responses: { '1xx': 0, '2xx': 245859, '3xx': 2, '4xx': 154, '5xx': 9 }
  },
  app: {
    pid: 20,
    start: '2023-01-16T15:47:19+00:00',
    end: '2023-01-16T15:48:19+00:00',
    metrics: {
      'timers.actastic.relation.search': [Object],
      'timers.actastic.relation.document_count': [Object],
      'timers.http.request.all': [Object],
      'timers.http.request.200': [Object],
      'timers.cron.local.cron-refresh_elasticsearch_license.total_job_time': [Object],
      'timers.frito_pie_analytics_service.request.duration': [Object],
      'timers.cron.local.cron-update_search_relevance_suggestions.total_job_time': [Object],
      'counters.http.request.all': 14,
      'counters.http.request.200': 14
    }
  },
  queues: {
    engine_destroyer: { pending: 0 },
    process_crawl: { pending: 0 },
    mailer: { pending: 0 },
    process_crawl2: { pending: 0 },
    failed: []
  },
  connectors: {
    alive: true,
    pool: {
      extract_worker_pool: [Object],
      subextract_worker_pool: [Object],
      publish_worker_pool: [Object]
    },
    job_store: { waiting: 0, working: 168, job_types: [Object] }
  },
  crawler: {
    global: { crawl_requests: [Object] },
    node: {
      pages_visited: 31,
      urls_allowed: 21,
      urls_denied: [Object],
      status_codes: [Object],
      queue_size: [Object],
      active_threads: 0,
      workers: [Object]
    }
  },
  product_usage: {
    app_search: { total_engines: 8 },
    workplace_search: {
      total_org_sources: 2,
      total_private_sources: 0,
      total_queries_last_30_days: 8
    },
    enterprise_search: { total_search_indices: 1 }
  }
}