Skip to content

Commit 0862f00

Browse files
committed
Refine OpenSearch adapter docs and dependencies
1 parent 785bcb8 commit 0862f00

18 files changed

Lines changed: 58 additions & 7 deletions

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
},
2828
"require": {
2929
"php": "^8.2",
30-
"guzzlehttp/guzzle": "^7.0",
3130
"opensearch-project/opensearch-php": "^2.6"
3231
},
3332
"require-dev": {

src/Documents/Document.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace DirectoryTree\OpenSearchAdapter\Documents;
44

5+
/**
6+
* @see https://docs.opensearch.org/latest/api-reference/document-apis/index-document/
7+
*/
58
class Document
69
{
710
/**
@@ -28,7 +31,7 @@ public function id(): string
2831
*/
2932
public function content(?string $key = null): mixed
3033
{
31-
if ($key === null) {
34+
if (is_null($key)) {
3235
return $this->content;
3336
}
3437

src/Documents/DocumentManager.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
use DirectoryTree\OpenSearchAdapter\Search\SearchResponse;
88
use OpenSearch\Client;
99

10+
/**
11+
* @see https://docs.opensearch.org/latest/api-reference/document-apis/bulk/
12+
* @see https://docs.opensearch.org/latest/api-reference/document-apis/delete-by-query/
13+
* @see https://docs.opensearch.org/latest/api-reference/search-apis/search/
14+
*/
1015
class DocumentManager
1116
{
1217
/**

src/Documents/Routing.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace DirectoryTree\OpenSearchAdapter\Documents;
44

5+
/**
6+
* @see https://docs.opensearch.org/latest/api-reference/search-apis/search-shards/
7+
*/
58
class Routing
69
{
710
/**

src/Exceptions/BulkRequestException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use ErrorException;
66

7+
/**
8+
* @see https://docs.opensearch.org/latest/api-reference/document-apis/bulk/
9+
*/
710
class BulkRequestException extends ErrorException
811
{
912
/**

src/Indices/Alias.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace DirectoryTree\OpenSearchAdapter\Indices;
44

5+
/**
6+
* @see https://docs.opensearch.org/latest/api-reference/index-apis/alias/
7+
*/
58
class Alias
69
{
710
/**

src/Indices/IndexBlueprint.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace DirectoryTree\OpenSearchAdapter\Indices;
44

5+
/**
6+
* @see https://docs.opensearch.org/latest/api-reference/index-apis/create-index/
7+
*/
58
class IndexBlueprint
69
{
710
/**

src/Indices/IndexManager.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
use OpenSearch\Client;
66
use OpenSearch\Namespaces\IndicesNamespace;
77

8+
/**
9+
* @see https://docs.opensearch.org/latest/api-reference/index-apis/create-index/
10+
* @see https://docs.opensearch.org/latest/api-reference/index-apis/put-mapping/
11+
* @see https://docs.opensearch.org/latest/api-reference/index-apis/update-settings/
12+
* @see https://docs.opensearch.org/latest/api-reference/index-apis/alias/
13+
*/
814
class IndexManager
915
{
1016
/**
@@ -63,14 +69,11 @@ public function create(IndexBlueprint $index): self
6369
'index' => $index->name(),
6470
];
6571

66-
$mapping = $index->mapping() === null ? [] : $index->mapping()->toArray();
67-
$settings = $index->settings() === null ? [] : $index->settings()->toArray();
68-
69-
if (! empty($mapping)) {
72+
if ($mapping = $index->mapping()?->toArray()) {
7073
$params['body']['mappings'] = $mapping;
7174
}
7275

73-
if (! empty($settings)) {
76+
if ($settings = $index->settings()?->toArray()) {
7477
$params['body']['settings'] = $settings;
7578
}
7679

src/Indices/Mapping.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
use Closure;
66

77
/**
8+
* @see https://docs.opensearch.org/latest/field-types/
9+
* @see https://docs.opensearch.org/latest/mappings/
10+
*
811
* @method $this alias(string $name, array|null $parameters = null)
912
* @method $this binary(string $name, array|null $parameters = null)
1013
* @method $this boolean(string $name, array|null $parameters = null)

src/Indices/MappingProperties.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use Closure;
77

88
/**
9+
* @see https://docs.opensearch.org/latest/field-types/
10+
* @see https://docs.opensearch.org/latest/mappings/
11+
*
912
* @method $this alias(string $name, array|null $parameters = null)
1013
* @method $this binary(string $name, array|null $parameters = null)
1114
* @method $this boolean(string $name, array|null $parameters = null)

0 commit comments

Comments
 (0)