Skip to content

Commit

Permalink
update quickstart document (#3871)
Browse files Browse the repository at this point in the history
* update quickstart

update quickstart to show the usage of document dynamic mapping

* Update docs/get-started/quickstart.md

Co-authored-by: François Massot <[email protected]>

* update default value of mode in index config

update defualt value of mode to dynamic in index configuration

* Update docs/get-started/quickstart.md

Co-authored-by: François Massot <[email protected]>

---------

Co-authored-by: François Massot <[email protected]>
  • Loading branch information
JerryKwan and fmassot authored Sep 25, 2023
1 parent 5f8bb5d commit 979e686
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 39 deletions.
18 changes: 0 additions & 18 deletions config/tutorials/stackoverflow/index-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@ index_id: stackoverflow

doc_mapping:
field_mappings:
- name: user
type: text
fast: true
tokenizer: raw
- name: tags
type: array<text>
fast: true
tokenizer: raw
- name: type
type: text
fast: true
tokenizer: raw
- name: title
type: text
tokenizer: default
Expand All @@ -29,12 +17,6 @@ doc_mapping:
tokenizer: default
record: position
stored: true
- name: questionId
type: u64
- name: answerId
type: u64
- name: acceptedAnswerId
type: u64
- name: creationDate
type: datetime
fast: true
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/index-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ The doc mapping defines how a document and the fields it contains are stored and
| Variable | Description | Default value |
| ------------- | ------------- | ------------- |
| `field_mappings` | Collection of field mapping, each having its own data type (text, binary, datetime, bool, i64, u64, f64). | `[]` |
| `mode` | Defines how quickwit should handle document fields that are not present in the `field_mappings`. In particular, the "dynamic" mode makes it possible to use quickwit in a schemaless manner. (See [mode](#mode)) | `lenient`
| `mode` | Defines how quickwit should handle document fields that are not present in the `field_mappings`. In particular, the "dynamic" mode makes it possible to use quickwit in a schemaless manner. (See [mode](#mode)) | `dynamic`
| `dynamic_mapping` | This parameter is only allowed when `mode` is set to `dynamic`. It then defines whether dynamically mapped fields should be indexed, stored, etc. | (See [mode](#mode))
| `tag_fields` | Collection of fields* already defined in `field_mappings` whose values will be stored as part of the `tags` metadata. [Learn more about tags](../overview/concepts/querying.md#tag-pruning). | `[]` |
| `store_source` | Whether or not the original JSON document is stored or not in the index. | `false` |
Expand Down
22 changes: 2 additions & 20 deletions docs/get-started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Let's create an index configured to receive Stackoverflow posts (questions and a
curl -o stackoverflow-index-config.yaml https://raw.githubusercontent.com/quickwit-oss/quickwit/main/config/tutorials/stackoverflow/index-config.yaml
```

The index config defines nine text fields. Among them there are five text fields: `user`, `tags`, `title`, `type` and `body`. Two of these fields, `body` and `title` are [indexed and tokenized](../configuration/index-config.md#text-type) and they are also used as default search fields, which means they will be used for search if you do not target a specific field in your query. The `tags` field is configured to accept multiple text values. The rest of the text fields are not tokenized and configured as [fast](/docs/configuration/index-config.md#text-type). There are three numeric fields `questionId`, `answerId` and `acceptedAnswerId`. And there is the `creationDate` field that serves as the timestamp for each record.
The index config defines three fields: `title`, `body` and `creationDate`. `title` and `body` are [indexed and tokenized](../configuration/index-config.md#text-type), and they are also used as default search fields, which means they will be used for search if you do not target a specific field in your query. `creationDate` serves as the timestamp for each record. There are no more explicit field definitions as we can use the default dynamic [mode](/docs/configuration/index-config.md#mode): the undeclared fields will still be indexed, by default fast fields are enabled to enable aggregation queries. and the `raw` tokenizer is used for text.

And here is the complete config:

Expand All @@ -93,18 +93,6 @@ index_id: stackoverflow

doc_mapping:
field_mappings:
- name: user
type: text
fast: true
tokenizer: raw
- name: tags
type: array<text>
fast: true
tokenizer: raw
- name: type
type: text
fast: true
tokenizer: raw
- name: title
type: text
tokenizer: default
Expand All @@ -115,12 +103,6 @@ doc_mapping:
tokenizer: default
record: position
stored: true
- name: questionId
type: u64
- name: answerId
type: u64
- name: acceptedAnswerId
type: u64
- name: creationDate
type: datetime
fast: true
Expand All @@ -133,7 +115,7 @@ search_settings:
default_search_fields: [title, body]

indexing_settings:
commit_timeout_secs: 5
commit_timeout_secs: 10
```
Now we can create the index with the command:
Expand Down

0 comments on commit 979e686

Please sign in to comment.