Skip to content

Commit

Permalink
Add multi indexes field capabilities rest api tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
fmassot committed Dec 27, 2023
1 parent dfb97fc commit 83fbe15
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,21 @@ method: [GET]
engines:
- quickwit
- elasticsearch
endpoint: fieldcaps/_field_caps?fields=host
endpoint: fieldcaps*/_field_caps?fields=host
expected:
indices:
- fieldcaps
- fieldcaps-2
fields:
host:
ip:
type: ip
metadata_field: false
searchable: true
aggregatable: true
indices:
- fieldcaps
- fieldcaps-2
---
# Compare ip field with elastic search
method: [GET]
Expand All @@ -277,17 +281,29 @@ method: [GET]
engines:
- quickwit
- elasticsearch
endpoint: fieldca*/_field_caps?fields=date
endpoint: fieldca*/_field_caps?fields=tags*
expected:
indices:
- fieldcaps
- fieldcaps-2
fields:
date:
date_nanos:
type: date_nanos
tags:
keyword:
type: keyword
metadata_field: false
searchable: true
aggregatable: true
indices:
- fieldcaps
- fieldcaps-2
tags-2:
keyword:
type: keyword
metadata_field: false
searchable: true
aggregatable: true
indices:
- fieldcaps-2
---
# Wildcard on index name + Wildcard without match
method: [GET]
Expand All @@ -298,6 +314,7 @@ endpoint: fieldca*,blub*/_field_caps?fields=date
expected:
indices:
- fieldcaps
- fieldcaps-2
fields:
date:
date_nanos:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ method: DELETE
endpoint: fieldcaps
status_code: null
---
method: DELETE
endpoint: fieldcaps-2
status_code: null
---
method: DELETE
endpoint: fieldcaps-1
status_code: null
---
# Create index 1
method: PUT
endpoint: fieldcaps
Expand All @@ -20,6 +28,23 @@ json: {
}
}
---
# Create index 2
method: PUT
endpoint: fieldcaps-2
json: {
"mappings": {
"properties": {
"host": {
"type": "ip",
"store": true
},
"date": {
"type": "date_nanos"
},
}
}
}
---
# Ingest documents in fieldcaps
method: POST
endpoint: _bulk
Expand All @@ -31,4 +56,5 @@ ndjson:
- {"name": "Fritz", "response": 30, "id": 5, "host": "192.168.0.1", "tags": ["nice", "cool"]}
- "index": { "_index": "fieldcaps" }
- {"nested": {"name": "Fritz", "response": 30}, "date": "2015-01-11T12:10:30Z", "host": "192.168.0.11", "tags": ["nice"]}

- "index": { "_index": "fieldcaps-2" }
- {"name": "Fritz", "response": 30, "id": 6, "host": "192.168.0.1", "tags": ["nice", "cool"], "tags-2": ["awesome"]}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ api_root: http://localhost:7280/api/v1/
endpoint: indexes/fieldcaps
status_code: null
---
method: DELETE
api_root: http://localhost:7280/api/v1/
endpoint: indexes/fieldcaps-2
status_code: null
---
# Create index
method: POST
api_root: http://localhost:7280/api/v1/
Expand All @@ -27,6 +32,29 @@ json:
type: ip
fast: true
---
# Create index
method: POST
api_root: http://localhost:7280/api/v1/
endpoint: indexes/
json:
version: "0.6"
index_id: fieldcaps-2
doc_mapping:
mode: dynamic
dynamic_mapping:
tokenizer: default
fast: true
field_mappings:
- name: date
type: datetime
input_formats:
- rfc3339
fast_precision: seconds
fast: true
- name: host
type: ip
fast: true
---
# Ingest documents
method: POST
api_root: http://localhost:7280/api/v1/
Expand Down Expand Up @@ -56,4 +84,12 @@ params:
ndjson:
- {"mixed": 5} # inter split mixed type
- {"mixed": -5.5}

---
# Ingest documents in index 2
method: POST
api_root: http://localhost:7280/api/v1/
endpoint: fieldcaps-2/ingest
params:
commit: force
ndjson:
- {"name": "Fritz", "response": 30, "id": 6, "host": "192.168.0.1", "tags": ["nice", "cool"], "tags-2": ["awesome"]}

0 comments on commit 83fbe15

Please sign in to comment.