Skip to content

Commit 6bfee07

Browse files
authored
Merge pull request #475 from meilisearch/http-methods
Update HTTP methods
2 parents 527d584 + e4d8b8e commit 6bfee07

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

meilisearch/index.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def update(self, primary_key: str) -> Dict[str, Any]:
7171
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
7272
"""
7373
payload = {'primaryKey': primary_key}
74-
return self.http.put(f'{self.config.paths.index}/{self.uid}', payload)
74+
return self.http.patch(f'{self.config.paths.index}/{self.uid}', payload)
7575

7676
def fetch_info(self) -> 'Index':
7777
"""Fetch the info of the index.
@@ -638,7 +638,7 @@ def update_settings(self, body: Dict[str, Any]) -> Dict[str, Any]:
638638
MeiliSearchApiError
639639
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
640640
"""
641-
return self.http.post(
641+
return self.http.patch(
642642
f'{self.config.paths.index}/{self.uid}/{self.config.paths.setting}',
643643
body
644644
)
@@ -701,7 +701,7 @@ def update_ranking_rules(self, body: List[str]) -> Dict[str, Any]:
701701
MeiliSearchApiError
702702
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
703703
"""
704-
return self.http.post(
704+
return self.http.put(
705705
self.__settings_url_for(self.config.paths.ranking_rules),
706706
body
707707
)
@@ -762,7 +762,7 @@ def update_distinct_attribute(self, body: Dict[str, Any]) -> Dict[str, Any]:
762762
MeiliSearchApiError
763763
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
764764
"""
765-
return self.http.post(
765+
return self.http.put(
766766
self.__settings_url_for(self.config.paths.distinct_attribute),
767767
body
768768
)
@@ -823,7 +823,7 @@ def update_searchable_attributes(self, body: List[str]) -> Dict[str, Any]:
823823
MeiliSearchApiError
824824
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
825825
"""
826-
return self.http.post(
826+
return self.http.put(
827827
self.__settings_url_for(self.config.paths.searchable_attributes),
828828
body
829829
)
@@ -884,7 +884,7 @@ def update_displayed_attributes(self, body: List[str]) -> Dict[str, Any]:
884884
MeiliSearchApiError
885885
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
886886
"""
887-
return self.http.post(
887+
return self.http.put(
888888
self.__settings_url_for(self.config.paths.displayed_attributes),
889889
body
890890
)
@@ -945,7 +945,7 @@ def update_stop_words(self, body: List[str]) -> Dict[str, Any]:
945945
MeiliSearchApiError
946946
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
947947
"""
948-
return self.http.post(
948+
return self.http.put(
949949
self.__settings_url_for(self.config.paths.stop_words),
950950
body
951951
)
@@ -1006,7 +1006,7 @@ def update_synonyms(self, body: Dict[str, List[str]]) -> Dict[str, Any]:
10061006
MeiliSearchApiError
10071007
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
10081008
"""
1009-
return self.http.post(
1009+
return self.http.put(
10101010
self.__settings_url_for(self.config.paths.synonyms),
10111011
body
10121012
)
@@ -1067,7 +1067,7 @@ def update_filterable_attributes(self, body: List[str]) -> Dict[str, Any]:
10671067
MeiliSearchApiError
10681068
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
10691069
"""
1070-
return self.http.post(
1070+
return self.http.put(
10711071
self.__settings_url_for(self.config.paths.filterable_attributes),
10721072
body
10731073
)
@@ -1129,7 +1129,7 @@ def update_sortable_attributes(self, body: List[str]) -> Dict[str, Any]:
11291129
MeiliSearchApiError
11301130
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
11311131
"""
1132-
return self.http.post(
1132+
return self.http.put(
11331133
self.__settings_url_for(self.config.paths.sortable_attributes),
11341134
body
11351135
)
@@ -1190,7 +1190,7 @@ def update_typo_tolerance(self, body: Dict[str, Any]) -> Dict[str, Any]:
11901190
MeiliSearchApiError
11911191
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
11921192
"""
1193-
return self.http.post(
1193+
return self.http.patch(
11941194
self.__settings_url_for(self.config.paths.typo_tolerance),
11951195
body
11961196
)

0 commit comments

Comments
 (0)