Skip to content

Commit 9e206bc

Browse files
authored
Clarify tag_fields types (#5638)
1 parent 99d2c47 commit 9e206bc

10 files changed

+194
-49
lines changed

docs/configuration/index-config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ The doc mapping defines how a document and the fields it contains are stored and
9191
| `field_mappings` | Collection of field mapping, each having its own data type (text, binary, datetime, bool, i64, u64, f64, ip, json). | `[]` |
9292
| `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`
9393
| `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))
94-
| `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). | `[]` |
94+
| `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). | `[]` |
9595
| `store_source` | Whether or not the original JSON document is stored or not in the index. | `false` |
9696
| `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` |
9797
| `partition_key` | If set, quickwit will route documents into different splits depending on the field name declared as the `partition_key`. | `null` |

quickwit/rest-api-tests/scenarii/qw_search_api/_setup.quickwit.yaml

-40
Original file line numberDiff line numberDiff line change
@@ -45,46 +45,6 @@ ndjson:
4545
- {"not_fast": 1684993003}
4646
---
4747
method: DELETE
48-
endpoint: indexes/tagged
49-
status_code: null
50-
---
51-
method: POST
52-
endpoint: indexes/
53-
json:
54-
version: "0.7"
55-
index_id: tagged
56-
doc_mapping:
57-
field_mappings:
58-
- name: seq
59-
type: u64
60-
- name: tag
61-
type: u64
62-
tag_fields: ["tag"]
63-
---
64-
method: POST
65-
endpoint: tagged/ingest
66-
params:
67-
commit: force
68-
ndjson:
69-
- {"seq": 1, "tag": 1}
70-
- {"seq": 2, "tag": 2}
71-
---
72-
method: POST
73-
endpoint: tagged/ingest
74-
params:
75-
commit: force
76-
ndjson:
77-
- {"seq": 1, "tag": 1}
78-
- {"seq": 3, "tag": null}
79-
---
80-
method: POST
81-
endpoint: tagged/ingest
82-
params:
83-
commit: force
84-
ndjson:
85-
- {"seq": 4, "tag": 1}
86-
---
87-
method: DELETE
8848
endpoint: indexes/nested
8949
status_code: null
9050
---
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# Delete index
21
method: DELETE
32
endpoint: indexes/simple
43
---
54
method: DELETE
6-
endpoint: indexes/tagged
7-
---
8-
method: DELETE
95
endpoint: indexes/nested
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# allowed types
2+
method: POST
3+
endpoint: indexes/
4+
json:
5+
version: "0.7"
6+
index_id: allowedtypes
7+
doc_mapping:
8+
mode: dynamic
9+
field_mappings:
10+
- name: text1
11+
type: text
12+
tokenizer: raw
13+
- name: number1
14+
type: u64
15+
- name: number2
16+
type: i64
17+
tag_fields:
18+
- text1
19+
- number1
20+
- number2
21+
---
22+
# tokenized not allowed
23+
method: POST
24+
endpoint: indexes/
25+
json:
26+
version: "0.7"
27+
index_id: tokenizedtype
28+
doc_mapping:
29+
mode: dynamic
30+
field_mappings:
31+
- name: text1
32+
type: text
33+
tokenizer: default
34+
tag_fields: [text1]
35+
status_code: 400
36+
---
37+
# float not allowed
38+
method: POST
39+
endpoint: indexes/
40+
json:
41+
version: "0.7"
42+
index_id: floattype
43+
doc_mapping:
44+
mode: dynamic
45+
field_mappings:
46+
- name: number3
47+
type: f64
48+
tag_fields: [number3]
49+
status_code: 400
50+
---
51+
# boolean not allowed
52+
method: POST
53+
endpoint: indexes/
54+
json:
55+
version: "0.7"
56+
index_id: booltype
57+
doc_mapping:
58+
mode: dynamic
59+
field_mappings:
60+
- name: boolean
61+
type: bool
62+
tag_fields: [boolean]
63+
status_code: 400
64+
---
65+
# json not allowed
66+
method: POST
67+
endpoint: indexes/
68+
json:
69+
version: "0.7"
70+
index_id: jsontype
71+
doc_mapping:
72+
mode: dynamic
73+
field_mappings:
74+
- name: json1
75+
type: json
76+
tag_fields: [json1]
77+
status_code: 400
78+
---
79+
# ip not allowed
80+
method: POST
81+
endpoint: indexes/
82+
json:
83+
version: "0.7"
84+
index_id: iptype
85+
doc_mapping:
86+
mode: dynamic
87+
field_mappings:
88+
- name: ip1
89+
type: ip
90+
tag_fields: [ip1]
91+
status_code: 400
92+
---
93+
# bytes not allowed
94+
method: POST
95+
endpoint: indexes/
96+
json:
97+
version: "0.7"
98+
index_id: bytestype
99+
doc_mapping:
100+
mode: dynamic
101+
field_mappings:
102+
- name: bytes1
103+
type: bytes
104+
tag_fields: [bytes1]
105+
status_code: 400
106+
---
107+
# bytes not allowed
108+
method: POST
109+
endpoint: indexes/
110+
json:
111+
version: "0.7"
112+
index_id: datetype
113+
doc_mapping:
114+
mode: dynamic
115+
field_mappings:
116+
- name: date1
117+
type: datetime
118+
input_formats:
119+
- rfc3339
120+
tag_fields: [date1]
121+
status_code: 400
122+
---
123+
# dynamic not allowed
124+
method: POST
125+
endpoint: indexes/
126+
json:
127+
version: "0.7"
128+
index_id: dynamictype
129+
doc_mapping:
130+
mode: dynamic
131+
tag_fields: [dynamic1]
132+
status_code: 400
133+
---

quickwit/rest-api-tests/scenarii/qw_search_api/0002_negative_tags.yaml renamed to quickwit/rest-api-tests/scenarii/tag_fields/0002_negative_tags.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# regression test for https://github.com/quickwit-oss/quickwit/issues/4698
2-
endpoint: tagged/search
2+
endpoint: simple/search
33
params:
44
query: "tag:1"
55
expected:
66
num_hits: 3
77
---
8-
endpoint: tagged/search
8+
endpoint: simple/search
99
params:
1010
query: "-tag:2"
1111
expected:
1212
num_hits: 4
1313
---
14-
endpoint: tagged/search
14+
endpoint: simple/search
1515
params:
1616
query: "tag:2"
1717
expected:
1818
num_hits: 1
1919
---
20-
endpoint: tagged/search
20+
endpoint: simple/search
2121
params:
2222
query: "-tag:1"
2323
expected:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
method: GET
2+
engines: ["quickwit"]
3+
api_root: "http://localhost:7280/api/v1/"
4+
headers:
5+
Content-Type: application/json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Delete possibly remaining index
2+
method: DELETE
3+
endpoint: indexes/allowedtypes
4+
status_code: null
5+
---
6+
method: DELETE
7+
endpoint: indexes/simple
8+
status_code: null
9+
---
10+
method: POST
11+
endpoint: indexes/
12+
json:
13+
version: "0.7"
14+
index_id: simple
15+
doc_mapping:
16+
field_mappings:
17+
- name: seq
18+
type: u64
19+
- name: tag
20+
type: u64
21+
tag_fields: ["tag"]
22+
---
23+
method: POST
24+
endpoint: simple/ingest
25+
params:
26+
commit: force
27+
ndjson:
28+
- {"seq": 1, "tag": 1}
29+
- {"seq": 2, "tag": 2}
30+
---
31+
method: POST
32+
endpoint: simple/ingest
33+
params:
34+
commit: force
35+
ndjson:
36+
- {"seq": 1, "tag": 1}
37+
- {"seq": 3, "tag": null}
38+
---
39+
method: POST
40+
endpoint: simple/ingest
41+
params:
42+
commit: force
43+
ndjson:
44+
- {"seq": 4, "tag": 1}
45+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
method: DELETE
2+
endpoint: indexes/allowedtypes
3+
status_code: null
4+
---
5+
method: DELETE
6+
endpoint: indexes/simple

0 commit comments

Comments
 (0)