Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify tag_fields types #5638

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion docs/configuration/index-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The doc mapping defines how a document and the fields it contains are stored and
| `field_mappings` | Collection of field mapping, each having its own data type (text, binary, datetime, bool, i64, u64, f64, ip, json). | `[]` |
| `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). | `[]` |
| `tag_fields` | Collection of fields* explicitly defined in `field_mappings` whose values will be stored as part of the `tags` metadata. Allowed types are: `text` (with raw tokenizer), `i64` and `u64`. [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` |
| `timestamp_field` | Timestamp field* used for sharding documents in splits. The field has to be of type `datetime`. [Learn more about time sharding](./../overview/architecture.md). | `None` |
| `partition_key` | If set, quickwit will route documents into different splits depending on the field name declared as the `partition_key`. | `null` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,46 +45,6 @@ ndjson:
- {"not_fast": 1684993003}
---
method: DELETE
endpoint: indexes/tagged
status_code: null
---
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: tagged
doc_mapping:
field_mappings:
- name: seq
type: u64
- name: tag
type: u64
tag_fields: ["tag"]
---
method: POST
endpoint: tagged/ingest
params:
commit: force
ndjson:
- {"seq": 1, "tag": 1}
- {"seq": 2, "tag": 2}
---
method: POST
endpoint: tagged/ingest
params:
commit: force
ndjson:
- {"seq": 1, "tag": 1}
- {"seq": 3, "tag": null}
---
method: POST
endpoint: tagged/ingest
params:
commit: force
ndjson:
- {"seq": 4, "tag": 1}
---
method: DELETE
endpoint: indexes/nested
status_code: null
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Delete index
method: DELETE
endpoint: indexes/simple
---
method: DELETE
endpoint: indexes/tagged
---
method: DELETE
endpoint: indexes/nested
133 changes: 133 additions & 0 deletions quickwit/rest-api-tests/scenarii/tag_fields/0001_allowed_types.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# allowed types
method: POST
endpoint: indexes/
json:
version: "0.7"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version: "0.7"
version: "0.8"

index_id: allowedtypes
doc_mapping:
mode: dynamic
field_mappings:
- name: text1
type: text
tokenizer: raw
- name: number1
type: u64
- name: number2
type: i64
tag_fields:
- text1
- number1
- number2
---
# tokenized not allowed
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: tokenizedtype
doc_mapping:
mode: dynamic
field_mappings:
- name: text1
type: text
tokenizer: default
tag_fields: [text1]
status_code: 400
---
# float not allowed
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: floattype
doc_mapping:
mode: dynamic
field_mappings:
- name: number3
type: f64
tag_fields: [number3]
status_code: 400
---
# boolean not allowed
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: booltype
doc_mapping:
mode: dynamic
field_mappings:
- name: boolean
type: bool
tag_fields: [boolean]
status_code: 400
---
# json not allowed
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: jsontype
doc_mapping:
mode: dynamic
field_mappings:
- name: json1
type: json
tag_fields: [json1]
status_code: 400
---
# ip not allowed
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: iptype
doc_mapping:
mode: dynamic
field_mappings:
- name: ip1
type: ip
tag_fields: [ip1]
status_code: 400
---
# bytes not allowed
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: bytestype
doc_mapping:
mode: dynamic
field_mappings:
- name: bytes1
type: bytes
tag_fields: [bytes1]
status_code: 400
---
# bytes not allowed
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: datetype
doc_mapping:
mode: dynamic
field_mappings:
- name: date1
type: datetime
input_formats:
- rfc3339
tag_fields: [date1]
status_code: 400
---
# dynamic not allowed
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: dynamictype
doc_mapping:
mode: dynamic
tag_fields: [dynamic1]
status_code: 400
---
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# regression test for https://github.com/quickwit-oss/quickwit/issues/4698
endpoint: tagged/search
endpoint: simple/search
params:
query: "tag:1"
expected:
num_hits: 3
---
endpoint: tagged/search
endpoint: simple/search
params:
query: "-tag:2"
expected:
num_hits: 4
---
endpoint: tagged/search
endpoint: simple/search
params:
query: "tag:2"
expected:
num_hits: 1
---
endpoint: tagged/search
endpoint: simple/search
params:
query: "-tag:1"
expected:
Expand Down
5 changes: 5 additions & 0 deletions quickwit/rest-api-tests/scenarii/tag_fields/_ctx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
method: GET
engines: ["quickwit"]
api_root: "http://localhost:7280/api/v1/"
headers:
Content-Type: application/json
45 changes: 45 additions & 0 deletions quickwit/rest-api-tests/scenarii/tag_fields/_setup.quickwit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Delete possibly remaining index
method: DELETE
endpoint: indexes/allowedtypes
status_code: null
---
method: DELETE
endpoint: indexes/simple
status_code: null
---
method: POST
endpoint: indexes/
json:
version: "0.7"
index_id: simple
doc_mapping:
field_mappings:
- name: seq
type: u64
- name: tag
type: u64
tag_fields: ["tag"]
---
method: POST
endpoint: simple/ingest
params:
commit: force
ndjson:
- {"seq": 1, "tag": 1}
- {"seq": 2, "tag": 2}
---
method: POST
endpoint: simple/ingest
params:
commit: force
ndjson:
- {"seq": 1, "tag": 1}
- {"seq": 3, "tag": null}
---
method: POST
endpoint: simple/ingest
params:
commit: force
ndjson:
- {"seq": 4, "tag": 1}
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
method: DELETE
endpoint: indexes/allowedtypes
status_code: null
---
method: DELETE
endpoint: indexes/simple
Loading