Enterprise Search APIs

edit

On this page

Initializing the Client

edit

Enterprise Search APIs are used for managing the Enterprise Search deployment.

Some of the APIs require HTTP basic auth of a user on the Elasticsearch cluster that has access to managing the cluster.

from elastic_enterprise_search import EnterpriseSearch

enterprise_search = EnterpriseSearch(
    "https://localhost:3002",
    http_auth=("elastic", "<password>")
)

Deployment Health API

edit

Checks the status and health of the Enterprise Search deployment using the get_health() method:

# Request:
enterprise_search.get_health()

# Response:
{
  "esqueues_me": {
    "Work::Engine::EngineDestroyer": {
      "created_at": 1611783321211,
      "processing_latency": 1167,
      "processing_started_at": 1611783322377,
      "scheduled_at": 1611783321210,
      "time_since_last_processed": 70015969,
      "time_since_last_scheduled": 70017136
    },
    ...
  },
  "filebeat": {
    "alive": True,
    "pid": 134,
    "restart_count": 0,
    "seconds_since_last_restart": -1
  },
  "jvm": {
    "gc": {
      "collection_count": 149,
      "collection_time": 3534,
      "garbage_collectors": {
        "PS MarkSweep": {
          "collection_count": 5,
          "collection_time": 1265
        },
        "PS Scavenge": {
          "collection_count": 144,
          "collection_time": 2269
        }
      }
    },
    "memory_pools": [
      "Code Cache",
      "Metaspace",
      "Compressed Class Space",
      "PS Eden Space",
      "PS Survivor Space",
      "PS Old Gen"
    ],
    "memory_usage": {
      "heap_committed": 1786773504,
      "heap_init": 1073741824,
      "heap_max": 1908932608,
      "heap_used": 674225760,
      "non_heap_committed": 421683200,
      "non_heap_init": 2555904,
      "object_pending_finalization_count": 0
    },
    "pid": 6,
    "threads": {
      "daemon_thread_count": 23,
      "peak_thread_count": 54,
      "thread_count": 50,
      "total_started_thread_count": 840
    },
    "uptime": 41033501,
    "vm_name": "OpenJDK 64-Bit Server VM",
    "vm_vendor": "AdoptOpenJDK",
    "vm_version": "25.252-b09"
  },
  "name": "f1b653d1bbd8",
  "system": {
    "java_version": "1.8.0_252",
    "jruby_version": "9.2.13.0",
    "os_name": "Linux",
    "os_version": "5.4.0-54-generic"
  },
  "version": {
    "build_date": "2021-01-06T15:24:44Z",
    "build_hash": "3a6edf8029dd285b60f1a6d63c741f46df7f195f",
    "number": "7.12.0"
  }
}

Read-Only Mode APIs

edit

You can get and set Read-Only Mode with the get_read_only() and put_read_only() methods:

# Request:
enterprise_search.get_read_only()

# Response:
{
  "enabled": False
}

# Request:
enterprise_search.put_read_only(body={"enabled": True})

# Response:
{
  "enabled": True
}

Deployment Stats API

edit

Gets stats about internal processes and data structures used within your Enterprise Search deployment using the get_stats() method:

# Request:
enterprise_search.get_stats()

# Response:
{
  "app": {
    "end": "2021-01-28T17:06:43+00:00",
    "metrics": {
      "counters.http.request.302": 2,
      "counters.http.request.all": 2,
      "timers.actastic.relation.document_count": {
        "max": 1.8278780044056475,
        "mean": 1.5509582590311766,
        "sum": 6.203833036124706
      },
      "timers.actastic.relation.search": {
        "max": 8.630949014332145,
        "mean": 5.581304353922057,
        "sum": 189.76434803334996
      },
      "timers.http.request.302": {
        "max": 11.984109878540039,
        "mean": 11.151552200317383,
        "sum": 22.303104400634766
      },
      "timers.http.request.all": {
        "max": 11.984109878540039,
        "mean": 11.151552200317383,
        "sum": 22.303104400634766
      }
    },
    "pid": 6,
    "start": "2021-01-28T17:05:43+00:00"
  },
  "connectors": {
    "alive": True,
    "job_store": {
      "job_types": {
        "delete": 0,
        "full": 0,
        "incremental": 0,
        "permissions": 0
      },
      "waiting": 0,
      "working": 0
    },
    "pool": {
      "extract_worker_pool": {
        "busy": 1,
        "idle": 7,
        "queue_depth": 0,
        "running": True,
        "size": 8,
        "total_completed": 16286,
        "total_scheduled": 16287
      }, ...
    }
  },
  "queues": {
    "connectors": {
      "pending": 0
    }, ...
  }
}