Skip to content

Instantly share code, notes, and snippets.

@sonnykt
Last active August 30, 2024 10:53
Show Gist options
  • Save sonnykt/cf38b6e6d1ae09ab5821b492fc9e631f to your computer and use it in GitHub Desktop.
Save sonnykt/cf38b6e6d1ae09ab5821b492fc9e631f to your computer and use it in GitHub Desktop.
Drupal - SDP - Debug Bay Elasticsearch from the CLI container

Get indices

curl -sXGET  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/_cat/indices?format=json&pretty=true"

curl -sXGET  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/_cat/indices/${SEARCH_HASH}--${SEARCH_INDEX}node?format=json&pretty=true"

Get ingest pipelines

curl -s  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/_ingest/pipeline?pretty=true"

curl -s  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/_ingest/pipeline/es_attachment?pretty=true"

curl -s  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/_ingest/pipeline/${SEARCH_INDEX}node_es_attachment?pretty=true"

Get mapping

curl -sXGET  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/${SEARCH_INDEX}node?pretty=true"

curl -sXGET  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/${SEARCH_INDEX}node/_mapping?pretty=true"

curl -sXGET  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/${SEARCH_INDEX}node/_mapping/field/title?pretty=true"

curl -sXGET  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/${SEARCH_INDEX}node/_mapping/field/es_attachment.*?pretty=true"

Get results

curl -sXGET  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/${SEARCH_INDEX}node/_search?pretty=true"

curl -sXGET  "http://${SEARCH_AUTH_USERNAME}:${SEARCH_AUTH_PASSWORD}@${SEARCH_HASH}.${SEARCH_URL}/${SEARCH_INDEX}node/_search?pretty=true" -d '
{
  "_source": {
    "includes": [
      "nid",
      "title",
      "es_attachment.filename",
      "es_attachment.attachment.date",
      "es_attachment.attachment.title",
      "es_attachment.attachment.comments",
      "es_attachment.attachment.content_length",
      "es_attachment.attachment.data"
    ]
  }
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment