Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion .vuepress/components/glossary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const glossary = {
'primary field':
'A special field containing the primary key and a unique document id. <br><br> 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. <br><br> Example: in a document with the primary field <code>"movie_id": "Abc_012"</code>, "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.<br><br> Example: In a document with the primary field <code>"id": "Abc_012"</code>, "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. <br><br> Example: in a document with the primary field <code>"movie_id": "Abc_012"</code>, "Abc_012" is the document id.',
schemaless:
Expand Down
1 change: 0 additions & 1 deletion guides/introduction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
29 changes: 16 additions & 13 deletions guides/introduction/quick_start_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <clientGlossary word="schemaless"/>, 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:

<CodeSamples id="getting_started_create_index_md" />
- [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 <clientGlossary word="field" /> which will serve as [<clientGlossary word="primary key" />](/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 <clientGlossary word="field" /> 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 <clientGlossary word="attribute" /> 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).

<CodeSamples id="getting_started_add_documents_md" />

Expand All @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions guides/main_concepts/indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions references/documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Documents are ordered by MeiliSearch depending on the hash of their id.

<RouteHighlighter method="POST" route="/indexes/:index_uid/documents"/>

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.

Expand Down Expand Up @@ -146,7 +146,7 @@ This `updateId` allows you to [track the current update](/references/updates.md)

<RouteHighlighter method="PUT" route="/indexes/:index_uid/documents"/>

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.

Expand Down