"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.phpDefinition = void 0; var _i18n = require("@kbn/i18n"); var _searchApiPanels = require("@kbn/search-api-panels"); var _doc_links = require("../../../../common/doc_links"); var _constants = require("../../constants"); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ const phpDefinition = { apiReference: _doc_links.docLinks.phpApiReference, basicConfig: _doc_links.docLinks.phpBasicConfig, buildSearchQuery: `$params = [ 'index' => 'books', 'body' => [ 'q' => 'snow' ] ]; $response = $client->search($params); print_r($response->asArray());`, configureClient: ({ url, apiKey }) => `$client = ClientBuilder::create() ->setHosts(['${url}']) ->setApiKey('${apiKey}') ->build();`, docLink: _doc_links.docLinks.phpClient, github: { link: 'https://github.com/elastic/elasticsearch-serverless-php', label: _i18n.i18n.translate('xpack.serverlessSearch.languages.php.githubLink', { defaultMessage: 'elasticsearch-serverless-php' }) }, iconType: 'php.svg', id: _searchApiPanels.Languages.PHP, ingestData: `$params = [ 'body' => [ [ 'index' => [ '_index' => 'books', '_id' => '9780553351927', ], ], [ 'name' => 'Snow Crash', 'author' => 'Neal Stephenson', 'release_date' => '1992-06-01', 'page_count' => 470, ], [ 'index' => [ '_index' => 'books', '_id' => '9780441017225', ], ], [ 'name' => 'Revelation Space', 'author' => 'Alastair Reynolds', 'release_date' => '2000-03-15', 'page_count' => 585, ], [ 'index' => [ '_index' => 'books', '_id' => '9780451524935', ], ], [ 'name' => '1984', 'author' => 'George Orwell', 'release_date' => '1985-06-01', 'page_count' => 328, ], [ 'index' => [ '_index' => 'books', '_id' => '9781451673319', ], ], [ 'name' => 'Fahrenheit 451', 'author' => 'Ray Bradbury', 'release_date' => '1953-10-15', 'page_count' => 227, ], [ 'index' => [ '_index' => 'books', '_id' => '9780060850524', ], ], [ 'name' => 'Brave New World', 'author' => 'Aldous Huxley', 'release_date' => '1932-06-01', 'page_count' => 268, ], [ 'index' => [ '_index' => 'books', '_id' => '9780385490818', ], ], [ 'name' => 'The Handmaid\'s Tale', 'author' => 'Margaret Atwood', 'release_date' => '1985-06-01', 'page_count' => 311, ], ], ]; $response = $client->bulk($params); echo $response->getStatusCode(); echo (string) $response->getBody();`, ingestDataIndex: ({ apiKey, url, indexName }) => `$client = ClientBuilder::create() ->setHosts(['${url}']) ->setApiKey('${apiKey}') ->build(); $params = [ 'body' => [ [ 'index' => [ '_index' => '${indexName !== null && indexName !== void 0 ? indexName : _constants.INDEX_NAME_PLACEHOLDER}', '_id' => '1', ], ], [ 'name' => 'foo', 'title' => 'bar', ], ], ]; $response = $client->bulk($params); echo $response->getStatusCode(); echo (string) $response->getBody(); `, installClient: 'composer require elasticsearch/elasticsearch', name: _i18n.i18n.translate('xpack.serverlessSearch.languages.php', { defaultMessage: 'PHP' }), testConnection: `$response = $client->info(); echo $response->getStatusCode(); echo (string) $response->getBody();` }; exports.phpDefinition = phpDefinition;