diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 85c6b097ff..dc0e6b0f65 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -365,14 +365,6 @@ search_guide_1: |- search_guide_2: |- $ curl 'http://localhost:7700/indexes/movies/search' \ --data '{ "q": "Avengers", "filters": "release_date > 795484800" }' -getting_started_create_index_md: |- - ```bash - $ curl \ - -X POST 'http://127.0.0.1:7700/indexes' \ - --data '{ - "uid" : "movies" - }' - ``` getting_started_add_documents_md: |- ```bash $ curl \ diff --git a/.vuepress/components/glossary.vue b/.vuepress/components/glossary.vue index 75289a0727..7716d47f1d 100644 --- a/.vuepress/components/glossary.vue +++ b/.vuepress/components/glossary.vue @@ -26,7 +26,7 @@ const glossary = { 'primary field': 'A special field containing the primary key and a unique document id.

Every document must possess a correctly formatted primary field in order to be indexed.', 'primary key': - 'The attribute of the primary field. The primary key\'s associated value is a unique document id. An index possesses only one primary key, which is shared among all its documents.

Example: in a document with the primary field "movie_id": "Abc_012", "movie_id" is the primary key.', + 'An attribute that must be present in every document of a given index, used to identify and distinguish documents.

Example: In a document with the primary field "id": "Abc_012", "id" is the index\'s primary key and "Abc_012" is the document\'s unique identifier.', 'document id': 'The value of the primary field. The document id acts as a unique identifier for storing documents.

Example: in a document with the primary field "movie_id": "Abc_012", "Abc_012" is the document id.', schemaless: diff --git a/guides/introduction/README.md b/guides/introduction/README.md index 983c398311..9c8a95d56f 100644 --- a/guides/introduction/README.md +++ b/guides/introduction/README.md @@ -6,7 +6,6 @@ Contents : - 🚀 Getting Started - [Download and launch MeiliSearch](/guides/introduction/quick_start_guide.md#download-and-launch) - - [Create your index](/guides/introduction/quick_start_guide.md#create-your-index) - [Add documents](/guides/introduction/quick_start_guide.md#add-documents) - [Search!](/guides/introduction/quick_start_guide.md#search) - 👩‍🚀 [What's next?](/guides/introduction/whats_next.md) diff --git a/guides/introduction/quick_start_guide.md b/guides/introduction/quick_start_guide.md index 65bb9c7aea..f9a522f4a2 100644 --- a/guides/introduction/quick_start_guide.md +++ b/guides/introduction/quick_start_guide.md @@ -22,28 +22,29 @@ Now that your MeiliSearch server is up and running, you should be able to commun Communication to the server is done through a [RESTful API](/references/README.md) or one of our [SDKs](/resources/sdks.md). -## Create your Index - -In MeiliSearch, the information is subdivided into indexes. Each [index](/guides/main_concepts/indexes.md) contains a data structure and associated documents. -Indexes can be comparable to SQL tables. Since MeiliSearch is , there's no need to define any attributes or data type when creating a table. +## Add Documents -In order to be able to store your documents in an index, it is required you create one first. +To add documents to MeiliSearch you must provide: - +- [Documents](/guides/main_concepts/documents.md) in the form of `JSON objects`. +- An [index](/guides/main_concepts/indexes.md) name (_uid_). An index is where the documents are stored. -[API references](/references/indexes.md) +> _If the index does not exist, MeiliSearch creates it when you first add documents._ -## Add Documents +To be processed, all documents must share one common which will serve as [](/guides/main_concepts/documents.md#primary-key) for the document. Values in that field must always be **unique**. -Once the index has been created, the next step is to fill it with [documents](/guides/main_concepts/documents.md). These documents will be used and returned when search queries will be performed on MeiliSearch. - -Documents are represented in `JSON format`. +```json +{ + "id": "123", + "title": "Superman" +} +``` -To be processed, all documents must share one common which will serve as [primary key](/guides/main_concepts/documents.md#primary-key) for the document. Values in that field must always be **unique**. +> The primary key is `id`, the document's unique identifier is `123`. There are [several ways to let MeiliSearch know what the primary key](/guides/main_concepts/documents.md#primary-key) is. The easiest one is to have an that contains the string `id` in a case-insensitive manner. -Below is an example to showcase how to add documents using the following test dataset: [movies.json](https://github.com/meilisearch/MeiliSearch/blob/master/datasets/movies/movies.json). +Below is an example to showcase how to add documents to an index called `movies` using the following test dataset: [movies.json](https://github.com/meilisearch/MeiliSearch/blob/master/datasets/movies/movies.json). @@ -61,6 +62,8 @@ You can check the status of the operation via the `updateId` and the [get update Checking the update status is not a mandatory step to search through your documents but could prove useful in tracing the origin of errors or unexpected behaviors. +[API references](/references/updates.md) + ## Search Now that your documents have been ingested into MeiliSearch, you are able to [search them](/guides/main_concepts/search.md). diff --git a/guides/main_concepts/indexes.md b/guides/main_concepts/indexes.md index 7ec12a2ad3..3b31013cb4 100644 --- a/guides/main_concepts/indexes.md +++ b/guides/main_concepts/indexes.md @@ -23,8 +23,8 @@ An index is created the first time documents are added to it or manually using t #### Example -Working on a fresh MeiliSearch instance with no indexes, let's add documents using the [add or replace documents endpoint](/references/documents.md#add-or-replace-documents). -We provide `movie` as our index name. Because there's currently no index of that name in our MeiliSearch instance, using the following code will: +In a new MeiliSearch instance without any index, let's add documents using the [add or replace documents endpoint](/references/documents.md#add-or-replace-documents). +We provide `movies` as our index. Because that index was not previously created, using the following code will: 1. Create the `movie` index. 2. Add the documents to it. diff --git a/references/documents.md b/references/documents.md index 9d99d30cd0..d8529d7af2 100644 --- a/references/documents.md +++ b/references/documents.md @@ -90,7 +90,7 @@ Documents are ordered by MeiliSearch depending on the hash of their id. -Add a list of [documents](/guides/main_concepts/documents.md) or replace them if they already exist. +Add a list of [documents](/guides/main_concepts/documents.md) or replace them if they already exist. If the provided index does not exist, it will be created. If you send an already existing document (same [id](/guides/main_concepts/documents.md#primary-key)) the **whole existing document** will be overwritten by the new document. Fields previously in the document not present in the new document are removed. @@ -146,7 +146,7 @@ This `updateId` allows you to [track the current update](/references/updates.md) -Add a list of documents and update them if they already. +Add a list of documents or update them if they already exist. If the provided index does not exist, it will be created. If you send an already existing document (same [id](/guides/main_concepts/documents.md#primary-key)) the old document will be only partially updated according to the fields of the new document. Thus, any fields not present in the new document are kept and remained unchanged.