# This code-samples file is used by the Meilisearch documentation
# Every example written here will be automatically fetched by
# the documentation on build
# You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples
---
facet_search_1: |-
  $client->index('books')->facetSearch(
    (new FacetSearchQuery())
        ->setFacetQuery('fiction')
        ->setFacetName('genres')
        ->setFilter(['rating > 3'])
  );
facet_search_2: |-
  $client->index('books')->updateFaceting(['sortFacetValuesBy' => ['genres' => 'count']]);
facet_search_3: |-
  $client->index('books')->facetSearch(
    (new FacetSearchQuery())
        ->setFacetQuery('c')
        ->setFacetName('genres')
  );
search_parameter_guide_show_ranking_score_1: |-
  $client->index('movies')->search('dragon', [
    'showRankingScore' => true
  ]);
search_parameter_guide_show_ranking_score_details_1: |-
  $client->index('movies')->search('dragon', [
    'showRankingScoreDetails' => true
  ]);
search_parameter_guide_attributes_to_search_on_1: |-
  $client->index('movies')->search('adventure', [
    'attributesToSearchOn' => ['overview']
  ]);
get_documents_post_1: |-
  $client->index('books')->getDocuments(
    (new DocumentsQuery())
      ->setFilter('(rating > 3 AND (genres = Adventure OR genres = Fiction)) AND language = English')
      ->setLimit(3)
      ->setFields(['title', 'genres', 'rating', 'language'])
  );
delete_documents_by_filter_1: |-
  $client->index('movies')->deleteDocuments(['filter' => 'genres = action OR genres = adventure']);
get_documents_1: |-
  $client->index('movies')->getDocuments((new DocumentsQuery())->setFilter('genres = action')->setLimit(2));
getting_started_faceting: |-
  $client->index('movies')
    ->updateFaceting([
      'maxValuesPerFacet' => 2,
      'sortFacetValuesBy' => ['*' => 'count']
    ]);
getting_started_pagination: |-
  $client->index('movies')->updatePagination(['maxTotalHits' => 500]);
synonyms_guide_1: |-
  $client->index('movies')->updateSynonyms([
    'great' => ['fantastic'],
    'fantastic' => ['great'],
  ]);
date_guide_index_1: |-
  $gamesJson = file_get_contents('games.json');
  $games = json_decode($gamesJson);

  $client->index('games')->addDocuments($games);
date_guide_filterable_attributes_1: |-
  $client->index('games')->updateFilterableAttributes(['release_timestamp']);
date_guide_filter_1: |-
  $client->index('games')->search('', [
    'filter' => ['release_timestamp >= 1514761200 AND release_timestamp < 1672527600']
  ]);
date_guide_sortable_attributes_1: |-
  $client->index('games')->updateSortableAttributes(['release_timestamp']);
date_guide_sort_1: |-
  $client->index('games')->search('', ['sort' => ['release_timestamp:desc']]);
async_guide_filter_by_date_1: |-
  $client->getTasks((new TasksQuery())->setAfterEnqueuedAt(new \DateTime('2020-10-11T11:49:53.000Z'));
async_guide_multiple_filters_1: |-
  $client->getTasks(
    (new TasksQuery())
      ->setStatuses(['processing'])
      ->setUids(['movies'])
      ->setTypes(['documentAdditionOrUpdate', 'documentDeletion'])
  );
async_guide_filter_by_ids_1: |-
  $client->getTasks((new TasksQuery())->setUids([5, 10, 13]));
async_guide_filter_by_statuses_1: |-
  $client->getTasks((new TasksQuery())->setStatuses(['failed', 'canceled']));
async_guide_filter_by_types_1: |-
  $client->getTasks((new TasksQuery())->setTypes(['dumpCreation', 'indexSwap']));
async_guide_filter_by_index_uids_1: |-
  $client->getTasks((new TasksQuery())->setIndexUids(['movies']));
delete_tasks_1: |-
  $client->deleteTasks((new DeleteTasksQuery())->setUids([1, 2]));
cancel_tasks_1: |-
  $client->cancelTasks((new CancelTasksQuery())->setUids([1, 2]));
async_guide_canceled_by_1: |-
  $client->getTasks((new TasksQuery())->setCanceledBy([9, 15]));
swap_indexes_1: |-
  $client->swapIndexes([['indexA', 'indexB'], ['indexX', 'indexY']]);
search_parameter_guide_hitsperpage_1: |-
  $client->index('movies')->search('', ['hitsPerPage' => 15]);
search_parameter_guide_page_1: |-
  $client->index('movies')->search('', ['page' => 2]);
getting_started_typo_tolerance: |-
  $client->index('books')->updateTypoTolerance([
    'minWordSizeForTypos' => [
      'oneTypo' => 4
    ]
  ]);
get_one_index_1: |-
  $client->index('movies')->fetchRawInfo();
list_all_indexes_1: |-
  $client->getIndexes((new IndexesQuery())->setLimit(3));
create_an_index_1: |-
  $client->createIndex('movies', ['primaryKey' => 'id']);
update_an_index_1: |-
  $client->updateIndex('movies', ['primaryKey' => 'id']);
delete_an_index_1: |-
  $client->deleteIndex('movies');
get_one_document_1: |-
  $client->index('movies')->getDocument(25684, ['id', 'title', 'poster', 'release_date']);
add_or_replace_documents_1: |-
  $client->index('movies')->addDocuments([
    [
      'id' => 287947,
      'title' => 'Shazam',
      'poster' => 'https://image.tmdb.org/t/p/w1280/xnopI5Xtky18MPhK40cZAGAOVeV.jpg',
      'overview' => 'A boy is given the ability to become an adult superhero in times of need with a single magic word.',
      'release_date' => '2019-03-23'
    ]
  ]);
add_or_update_documents_1: |-
  $client->index('movies')->updateDocuments([
    [
      'id' => 287947,
      'title' => 'Shazam ⚡️',
      'genres' => 'comedy'
    ]
  ]);
delete_all_documents_1: |-
  $client->index('movies')->deleteAllDocuments();
delete_one_document_1: |-
  $client->index('movies')->deleteDocument(25684);
delete_documents_by_batch_1: |-
  $client->index('movies')->deleteDocuments([23488, 153738, 437035, 363869]);
search_post_1: |-
  $client->index('movies')->search('american ninja');
get_all_tasks_1: |-
  $client->getTasks();
get_task_1: |-
  $client->getTask(1);
get_one_key_1: |-
  $client->getKey('6062abda-a5aa-4414-ac91-ecd7944c0f8d');
get_all_keys_1: |-
  $client->getKeys((new KeysQuery())->setLimit(3));
create_a_key_1: |-
  $client->createKey([
    'description' => 'Add documents: Products API key',
    'actions' => ['documents.add'],
    'indexes' => ['products'],
    'expiresAt' => '2042-04-02T00:42:42Z',
  ]);
update_a_key_1: |-
  $client->updateKey('6062abda-a5aa-4414-ac91-ecd7944c0f8d',
    [
      'name' => 'Products/Reviews API key',
      'description' => 'Manage documents: Products/Reviews API key'
    ]);
delete_a_key_1: |-
  $client->deleteKey('6062abda-a5aa-4414-ac91-ecd7944c0f8d');
get_settings_1: |-
  $client->index('movies')->getSettings();
update_settings_1: |-
  $client->index('movies')->updateSettings([
    'rankingRules' => [
      'words',
      'typo',
      'proximity',
      'attribute',
      'sort',
      'exactness',
      'release_date:desc',
      'rank:desc'
    ],
    'distinctAttribute' => 'movie_id',
    'searchableAttributes' => [
      'title',
      'overview',
      'genres'
    ],
    'displayedAttributes' => [
      'title',
      'overview',
      'genres',
      'release_date'
    ],
    'stopWords' => [
      'the',
      'a',
      'an'
    ],
    'sortableAttributes' => [
      'title',
      'release_date'
    ],
    'synonyms' => [
      'wolverine' => ['xmen', 'logan'],
      'logan' => ['wolverine']
    ],
    'typoTolerance' => [
        'minWordSizeForTypos' => [
          'oneTypo' => 8,
          'twoTypos' => 10
        ],
        'disableOnAttributes' => ['title']
    ],
    'pagination' => [
      'maxTotalHits' => 5000
    ],
    'faceting' => [
      'maxValuesPerFacet' => 200
    ],
    'searchCutoffMs' => 150
  ]);
reset_settings_1: |-
  $client->index('movies')->resetSettings();
get_synonyms_1: |-
  $client->index('movies')->getSynonyms();
update_synonyms_1: |-
  $client->index('movies')->updateSynonyms([
    'wolverine' => ['xmen', 'logan'],
    'logan' => ['wolverine', 'xmen'],
    'wow' => ['world of warcraft']
  ]);
reset_synonyms_1: |-
  $client->index('movies')->resetSynonyms();
get_stop_words_1: |-
  $client->index('movies')->getStopWords();
update_stop_words_1: |-
  $client->index('movies')->updateStopWords(['the', 'of', 'to']);
reset_stop_words_1: |-
  $client->index('movies')->resetStopWords();
get_ranking_rules_1: |-
  $client->index('movies')->getRankingRules();
update_ranking_rules_1: |-
  $client->index('movies')->updateRankingRules([
    'words',
    'typo',
    'proximity',
    'attribute',
    'sort',
    'exactness',
    'release_date:asc',
    'rank:desc'
  ]);
reset_ranking_rules_1: |-
  $client->index('movies')->resetRankingRules();
get_distinct_attribute_1: |-
  $client->index('shoes')->getDistinctAttribute();
update_distinct_attribute_1: |-
  $client->index('shoes')->updateDistinctAttribute('skuid');
reset_distinct_attribute_1: |-
  $client->index('shoes')->resetDistinctAttribute();
get_filterable_attributes_1: |-
  $client->index('movies')->getFilterableAttributes();
update_filterable_attributes_1: |-
  $client->index('movies')->updateFilterableAttributes([
    'author',
    [
        'attributePatterns' => ['genres'],
        'features' => [
            'facetSearch' => true,
            'filter' => [
                'equality' => true,
                'comparison' => false,
            ],
        ],
    ],
  ]);
reset_filterable_attributes_1: |-
  $client->index('movies')->resetFilterableAttributes();
get_searchable_attributes_1: |-
  $client->index('movies')->getSearchableAttributes();
update_searchable_attributes_1: |-
  $client->index('movies')->updateSearchableAttributes([
    'title',
    'overview',
    'genres'
  ]);
reset_searchable_attributes_1: |-
  $client->index('movies')->resetSearchableAttributes();
get_displayed_attributes_1: |-
  $client->index('movies')->getDisplayedAttributes();
update_displayed_attributes_1: |-
  $client->index('movies')->updateDisplayedAttributes([
    'title',
    'overview',
    'genres',
    'release_date'
  ]);
reset_displayed_attributes_1: |-
  $client->index('movies')->resetDisplayedAttributes();
get_typo_tolerance_1: |-
  $client->index('books')->getTypoTolerance();
update_typo_tolerance_1: |-
  $client->index('books')->updateTypoTolerance([
    'minWordSizeForTypos' => [
        'oneTypo' => 4,
        'twoTypos' => 10
      ],
      'disableOnAttributes' => [
        'title'
    ]
  ]);
reset_typo_tolerance_1: |-
  $client->index('books')->resetTypoTolerance();
get_sortable_attributes_1: |-
  $client->index('books')->getSortableAttributes();
update_sortable_attributes_1: |-
  $client->index('books')->updateSortableAttributes([
    'price',
    'author'
  ]);
reset_sortable_attributes_1: |-
  $client->index('books')->resetSortableAttributes();
get_index_stats_1: |-
  $client->index('movies')->stats();
get_indexes_stats_1: |-
  $client->stats();
get_health_1: |-
  $client->health();
get_version_1: |-
  $client->version();
distinct_attribute_guide_1: |-
  $client->index('jackets')->updateDistinctAttribute('product_id');
field_properties_guide_searchable_1: |-
  $client->index('movies')->updateSearchableAttributes([
    'title',
    'overview',
    'genres'
  ]);
field_properties_guide_displayed_1: |-
  $client->index('movies')->updateDisplayedAttributes([
    'title',
    'overview',
    'genres',
    'release_date'
  ]);
filtering_guide_1: |-
  $client->index('movie_ratings')->search('Avengers', [
    'filter' => 'release_date > 795484800'
  ]);
filtering_guide_2: |-
  $client->index('movie_ratings')->search('Batman', [
    'filter' => 'release_date > 795484800 AND (director = "Tim Burton" OR director = "Christopher Nolan")'
  ]);
filtering_guide_3: |-
  $client->index('movie_ratings')->search('Planet of the Apes', [
    'filter' => 'release_date > 1577884550 AND (NOT director = "Tim Burton")'
  ]);
filtering_guide_nested_1: |-
  $client->index('movie_ratings')->search('thriller', [
    'filter' => 'rating.users >= 90'
  ]);
search_parameter_guide_query_1: |-
  $client->index('movies')->search('shifu');
search_parameter_guide_offset_1: |-
  $client->index('movies')->search('shifu', ['offset' => 1]);
search_parameter_guide_limit_1: |-
  $client->index('movies')->search('shifu', ['limit' => 2]);
search_parameter_guide_retrieve_1: |-
  $client->index('movies')->search('shifu', [
    'attributesToRetrieve' => ['overview', 'title']
  ]);
search_parameter_guide_crop_1: |-
  $client->index('movies')->search('shifu', [
    'attributesToCrop' => ['overview'],
    'cropLength' => 5
  ]);
search_parameter_guide_crop_marker_1: |-
  $client->index('movies')->search('shifu', [
    'attributesToCrop' => ['overview'],
    'cropMarker' => '[…]'
  ]);
search_parameter_guide_highlight_1: |-
  $client->index('movies')->search('winter feast', [
    'attributesToHighlight' => ['overview']
  ]);
search_parameter_guide_highlight_tag_1: |-
  $client->index('movies')->search('winter feast', [
    'attributesToHighlight' => ['overview'],
    'highlightPreTag' => '<span class="highlight">',
    'highlightPostTag' => '</span>'
  ]);
search_parameter_guide_show_matches_position_1: |-
  $client->index('movies')->search('winter feast', [
    'attributesToHighlight' => ['overview'],
    'showMatchesPosition' => true
  ]);
search_parameter_guide_matching_strategy_1: |-
  $client->index('movies')->search('big fat liar', ['matchingStrategy' => 'last']);
search_parameter_guide_matching_strategy_2: |-
  $client->index('movies')->search('big fat liar', ['matchingStrategy' => 'all']);
typo_tolerance_guide_1: |-
  $client->index('movies')->updateTypoTolerance([
    'enabled' => false
  ]);
typo_tolerance_guide_2: |-
  $client->index('movies')->updateTypoTolerance([
    'disableOnAttributes' => ['title']
  ]);
typo_tolerance_guide_3: |-
  $client->index('movies')->updateTypoTolerance([
    'disableOnWords' => ['shrek']
  ]);
typo_tolerance_guide_4: |-
  $client->index('movies')->updateTypoTolerance([
    'minWordSizeForTypos' => [
      'oneTypo' => 4,
      'twoTypos' => 10
    ]
  ]);
typo_tolerance_guide_5: |-
  $client->index('movies')->updateTypoTolerance([
    'disableOnNumbers' => true
  ]);
add_movies_json_1: |-
  $moviesJson = file_get_contents('movies.json');
  $movies = json_decode($moviesJson);

  $client->index('movies')->addDocuments($movies);
landing_getting_started_1: |-
  $client = new Client('http://localhost:7700', 'masterKey');

  $client->index('movies')->addDocuments([
    ['id' => 1, 'title' => 'Carol'],
    ['id' => 2, 'title' => 'Wonder Woman'],
    ['id' => 3, 'title' => 'Life of Pi'],
    ['id' => 4, 'title' => 'Mad Max: Fury Road'],
    ['id' => 5, 'title' => 'Moana'],
    ['id' => 6, 'title' => 'Philadelphia'],
  ]);
getting_started_add_documents: |-
  /**
   * Using `meilisearch-php` with the Guzzle HTTP client, in the command line:
   *   composer require meilisearch/meilisearch-php \
   *     guzzlehttp/guzzle \
   *     http-interop/http-factory-guzzle:^1.0
   */

  /**
   * In your PHP file:
   */
  <?php

  require_once __DIR__ . '/vendor/autoload.php';

  use Meilisearch\Client;

  $client = new Client('http://localhost:7700', 'aSampleMasterKey');

  $movies_json = file_get_contents('movies.json');
  $movies = json_decode($movies_json);

  $client->index('movies')->addDocuments($movies);

getting_started_check_task_status: |-
  $client->getTask(0);
getting_started_search: |-
  $client->index('movies')->search('botman');
getting_started_add_meteorites: |-
  $client = new Client('http://localhost:7700');

  $meteorites_json = file_get_contents('meteorites.json');
  $meteorites = json_decode($meteorites_json);

  $client->index('meteorites')->addDocuments($meteorites);
getting_started_update_ranking_rules: |-
  $client->index('movies')->updateRankingRules([
    'exactness',
    'words',
    'typo',
    'proximity',
    'attribute',
    'sort',
    'release_date:asc',
    'rank:desc'
  ]);
getting_started_update_displayed_attributes: |-
  $client->index('movies')->updateDisplayedAttributes([
    'title',
    'overview',
    'poster'
  ]);
getting_started_update_searchable_attributes: |-
  $client->index('movies')->updateSearchableAttributes(['title']);
getting_started_update_stop_words: |-
  $client->index('movies')->updateStopWords(['the']);
getting_started_synonyms: |-
  $client->index('movies')->updateSynonyms([
    'winnie' => ['piglet'],
    'piglet' => ['winnie']
  ]);
getting_started_filtering: |-
  $client->index('meteorites')->search('', [
    'filter' => 'mass < 200'
  ]);
getting_started_geo_radius: |-
  $client->index('meteorites')->search('', [
    'filter' => '_geoRadius(46.9480, 7.4474, 210000)'
  ]);
getting_started_geo_point: |-
  $client->index('meteorites')->search('', [
    'sort' => ['_geoPoint(48.8583701,2.2922926):asc']
  ]);
getting_started_sorting: |-
  $client->index('meteorites')->search('', [
    'filter' => 'mass < 200',
    'sort' => ['mass:asc']
  ]);
getting_started_configure_settings: |-
  $client->index('meteorites')->updateSettings([
    'filterableAttributes' => [
      'mass',
      '_geo'
    ],
    'sortableAttributes' => [
      'mass',
      '_geo'
    ]
  ]);
filtering_update_settings_1: |-
  $client->index('movies')->updateFilterableAttributes(['director', 'genres']);
faceted_search_walkthrough_filter_1: |-
  $client->index('movies')->search('thriller', [
    'filter' => [['genres = Horror', 'genres = Mystery'], 'director = "Jordan Peele"']
  ]);
faceted_search_update_settings_1: |-
  $client->index('movie_ratings')->updateFilterableAttributes(['genres', 'rating', 'language']);
faceted_search_1: |-
  $client->index('books')->search('classic', [
    'facets' => ['genres', 'rating', 'language']
  ]);
post_dump_1: |-
  $client->createDump();
create_snapshot_1: |-
  $client->createSnapshot();
phrase_search_1: |-
  $client->index('movies')->search('"african american" horror');
sorting_guide_update_sortable_attributes_1: |-
  $client->index('books')->updateSortableAttributes([
    'author',
    'price'
  ]);
sorting_guide_update_ranking_rules_1: |-
  $client->index('books')->updateRankingRules([
    'words',
    'sort',
    'typo',
    'proximity',
    'attribute',
    'exactness'
  ]);
sorting_guide_sort_parameter_1: |-
  $client->index('books')->search('science fiction', ['sort' => ['price:asc']]);
sorting_guide_sort_parameter_2: |-
  $client->index('books')->search('butler', ['sort' => ['author:desc']]);
sorting_guide_sort_nested_1: |-
  $client->index('books')->search('science fiction', ['sort' => ['rating.users:asc']]);
search_parameter_guide_sort_1: |-
  $client->index('books')->search('science fiction', ['sort' => ['price:asc']]);
search_parameter_guide_facet_stats_1: |-
  $client->index('movie_ratings')->search('Batman', [
    'facets' => ['genres', 'rating']
  ]);
geosearch_guide_filter_settings_1: |-
  $client->index('restaurants')->updateFilterableAttributes([
    '_geo'
  ]);
geosearch_guide_filter_usage_1: |-
  $client->index('restaurants')->search('', [
    'filter' => '_geoRadius(45.472735, 9.184019, 2000)'
  ]);
geosearch_guide_filter_usage_2: |-
  $client->index('restaurants')->search('', [
    'filter' => '_geoRadius(45.472735, 9.184019, 2000) AND type = pizza'
  ]);
geosearch_guide_filter_usage_3: |-
  $client->index('restaurants')->search('', [
    'filter' => '_geoBoundingBox([45.494181, 9.214024], [45.449484, 9.179175])'
  ]);
geosearch_guide_sort_settings_1: |-
  $client->index('restaurants')->updateSortableAttributes([
    '_geo'
  ]);
geosearch_guide_sort_usage_1: |-
  $client->index('restaurants')->search('', [
    'sort' => ['_geoPoint(48.8561446,2.2978204):asc']
  ]);
geosearch_guide_sort_usage_2: |-
  $client->index('restaurants')->search('', [
    'sort' => ['_geoPoint(48.8561446,2.2978204):asc', 'rating:desc']
  ]);
primary_field_guide_create_index_primary_key: |-
  $client->createIndex('books', ['primaryKey' => 'reference_number']);
primary_field_guide_update_document_primary_key: |-
  $client->updateIndex('books', ['primaryKey' => 'title']);
primary_field_guide_add_document_primary_key: |-
  $client->index('books')->addDocuments([
    [
      'reference_number' => 287947,
      'title' => 'Diary of a Wimpy Kid',
      'author' => 'Jeff Kinney',
      'genres' => ['comedy', 'humor'],
      'price' => 5.00
    ]
  ], 'reference_number');
security_guide_search_key_1: |-
  $client = new Client('http://localhost:7700', 'masterKey');
  $client->index('patient_medical_records')->search();
security_guide_update_key_1: |-
  $client = new Client('http://localhost:7700', 'masterKey');
  $client->updateKey('74c9c733-3368-4738-bbe5-1d18a5fecb37',
    ['description' => 'Default Search API Key']
  );
security_guide_create_key_1: |-
  $client = new Client('http://localhost:7700', 'masterKey');
  $client->createKey([
    'description' => 'Search patient records key',
    'actions' => ['search'],
    'indexes' => ['patient_medical_records'],
    'expiresAt' => '2023-01-01T00:00:00Z',
  ]);
security_guide_list_keys_1: |-
  $client = new Client('http://localhost:7700', 'masterKey');
  $client->getKeys();
security_guide_delete_key_1: |-
  $client = new Client('http://localhost:7700', 'masterKey');
  $client->deleteKey('ac5cd97d-5a4b-4226-a868-2d0eb6d197ab');
authorization_header_1: |-
  $client = new Client('http://localhost:7700', 'masterKey');
  $client->getKeys();
tenant_token_guide_generate_sdk_1: |-
  $apiKeyUid = '85c3c2f9-bdd6-41f1-abd8-11fcf80e0f76';
  $searchRules = (object) [
    'patient_medical_records' => (object) [
      'filter' => 'user_id = 1',
    ]
  ];
  $options = [
      'apiKey' => 'B5KdX2MY2jV6EXfUs6scSfmC...',
      'expiresAt' => new DateTime('2025-12-20'),
  ];

  $token = $client->generateTenantToken($apiKeyUid, $searchRules, $options);
tenant_token_guide_search_sdk_1: |-
  $frontEndClient = new Client('http://localhost:7700', $token);
  $frontEndClient->index('patient_medical_records')->search('blood test');
get_all_tasks_paginating_1: |-
  $taskQuery = (new TasksQuery())->setLimit(2)->setFrom(10));
  $client->getTasks($taskQuery);
get_all_tasks_paginating_2: |-
  $taskQuery = (new TasksQuery())->setLimit(2)->setFrom(8));
  $client->getTasks($taskQuery);
get_pagination_settings_1: |-
  $client->index('books')->getPagination();
update_pagination_settings_1: |-
  $client->index('books')->updateSettings([
    'pagination' => [
      'maxTotalHits' => 100
    ]
  ]);
reset_pagination_settings_1: |-
  $client->index('books')->resetPagination();
get_faceting_settings_1: |-
  $client->index('books')->getFaceting();
update_faceting_settings_1: |-
  $client->index('books')->updateFaceting([
    'maxValuesPerFacet' => 2,
    'sortFacetValuesBy' => ['*' => 'alpha', 'genres' => 'count']
  ]);
reset_faceting_settings_1: |-
  $client->index('books')->resetFaceting();
multi_search_1: |-
  $client->multiSearch([
      (new SearchQuery())
          ->setIndexUid('movies')
          ->setQuery('pooh')
          ->setLimit(5),
      (new SearchQuery())
          ->setIndexUid('movies')
          ->setQuery('nemo')
          ->setLimit(5),
      (new SearchQuery())
          ->setIndexUid('movie_ratings')
          ->setQuery('us')
    ]);
get_dictionary_1: |-
  $client->index('books')->getDictionary();
update_dictionary_1: |-
  $client->index('books')->updateDictionary(['J. R. R.', 'W. E. B.']);
reset_dictionary_1: |-
  $client->index('books')->resetDictionary();
get_separator_tokens_1: |-
  $client->index('articles')->getSeparatorTokens();
update_separator_tokens_1: |-
  $client->index('articles')->updateSeparatorTokens(['|', '&hellip;']);
reset_separator_tokens_1: |-
  $client->index('articles')->resetSeparatorTokens();
get_non_separator_tokens_1: |-
  $client->index('articles')->getNonSeparatorTokens();
update_non_separator_tokens_1: |-
  $client->index('articles')->updateNonSeparatorTokens(['@', '#']);
reset_non_separator_tokens_1: |-
  $client->index('articles')->resetNonSeparatorTokens();
get_proximity_precision_settings_1: |-
  $client->index('books')->getProximityPrecision();
update_proximity_precision_settings_1: |-
  $client->index('books')->updateProximityPrecision('byAttribute');
reset_proximity_precision_settings_1: |-
  $client->index('books')->resetProximityPrecision();
get_search_cutoff_1: |-
  $client->index('movies')->getSearchCutoffMs();
update_search_cutoff_1: |-
  $client->index('movies')->updateSearchCutoffMs(150);
reset_search_cutoff_1: |-
  $client->index('movies')->resetSearchCutoffMs();
negative_search_1: |-
  $client->index('movies')->search('-escape');
negative_search_2: |-
  $client->index('movies')->search('-"escape"');
search_parameter_reference_retrieve_vectors_1: |-
  $client->index('INDEX_NAME')->search('kitchen utensils', [
    'retrieveVectors' => true,
    'hybrid' => [
      'embedder': 'EMBEDDER_NAME'
    ]
  ]);
search_parameter_guide_hybrid_1: |-
  $client->index('INDEX_NAME')->search('kitchen utensils', [
    'hybrid' => [
      'semanticRatio' => 0.9,
      'embedder' => 'EMBEDDER_NAME'
    ]
  ]);
search_parameter_reference_ranking_score_threshold_1: |-
  $client->index('INDEX_NAME')->search('badman', [
    'rankingScoreThreshold' => 0.2
  ]);
search_parameter_reference_distinct_1: |-
  $client->index('INDEX_NAME')->search('QUERY TERMS', [
    'distinct' => 'ATTRIBUTE_A'
  ]);
distinct_attribute_guide_filterable_1: |-
  $client->index('products')->updateFilterableAttributes(['product_id', 'sku', 'url']);
distinct_attribute_guide_distinct_parameter_1: |-
  $client->index('products')->search('white shirt', [
    'distinct' => 'sku'
  ]);
search_parameter_guide_matching_strategy_3: |-
  $client->index('movies')->search('white shirt', ['matchingStrategy' => 'frequency']);
get_similar_post_1: |-
  $similarQuery = new SimilarDocumentsQuery('TARGET_DOCUMENT_ID', 'default');
  $client->index('INDEX_NAME')->searchSimilarDocuments($similarQuery);
multi_search_federated_1: |-
  $client->multiSearch([
      (new SearchQuery())
        ->setIndexUid('movies'))
        ->setQuery('batman'),
      (new SearchQuery())
        ->setIndexUid('comics')
        ->setQuery('batman'),
    ],
    (new MultiSearchFederation())
  );
search_parameter_reference_locales_1: |-
  $client->index('INDEX_NAME')->search('QUERY TEXT IN JAPANESE', [
    'locales' => ['jpn']
  ]);
get_localized_attribute_settings_1: |-
  $client->index('INDEX_NAME')->getLocalizedAttributes();
update_localized_attribute_settings_1: |-
  $client->index('INDEX_NAME')->updateLocalizedAttributes([
    'locales' => ['jpn'],
    'attributePatterns' => ['*_ja']
  ]);
reset_localized_attribute_settings_1: |-
  $client->index('INDEX_NAME')->resetLocalizedAttributes();
get_facet_search_settings_1: |-
  $client->index('INDEX_NAME')->getFacetSearch();
update_facet_search_settings_1: |-
  $client->index('INDEX_NAME')->updateFacetSearch(false);
reset_facet_search_settings_1: |-
  $client->index('INDEX_NAME')->resetFacetSearch();
get_prefix_search_settings_1: |-
  $client->index('INDEX_NAME')->getPrefixSearch();
update_prefix_search_settings_1: |-
  $client->index('INDEX_NAME')->updatePrefixSearch('disabled');
reset_prefix_search_settings_1: |-
  $client->index('INDEX_NAME')->resetPrefixSearch();
get_all_batches_1: |-
  $client->getBatches();
get_batch_1: |-
  $client->getBatch(BATCH_UID);
update_embedders_1: |-
  $client->updateEmbedders([
    'default' => [
      'source' => 'openAi',
      'apiKey' => 'OPEN_AI_API_KEY',
      'model' => 'text-embedding-3-small',
      'documentTemplate' => 'A document titled '{{doc.title}}' whose description starts with {{doc.overview|truncatewords: 20}}'
    ]
  ]);
search_parameter_reference_media_1: |-
  $client->index('INDEX_NAME')->search('a futuristic movie', [
    'hybrid' => [
      'embedder' => 'EMBEDDER_NAME'
    ],
    'media' => [
      'textAndPoster' => [
        'text' => 'a futuristic movie',
        'image' => [
          'mime' => 'image/jpeg',
          'data' => 'base64EncodedImageData'
        ]
      ]
    ]
  ]);
