Update the elasticsearch mappings for issues to use long instead of integer for int64 (#3982)

This updates the mapping definition of the elasticsearch issue indexer backend to use `long` instead of `integer`s wherever the go type is a `int64`. Without it larger instances could run into an issue.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3982
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
Co-committed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
This commit is contained in:
Mai-Lapyst 2024-06-04 07:37:59 +00:00 committed by Earl Warren
parent 507c0143ee
commit e58ce86264
3 changed files with 22 additions and 18 deletions

View file

@ -45,6 +45,10 @@ jobs:
container: container:
image: 'docker.io/node:20-bookworm' image: 'docker.io/node:20-bookworm'
services: services:
elasticsearch:
image: elasticsearch:7.5.0
env:
discovery.type: single-node
minio: minio:
image: bitnami/minio:2024.3.30 image: bitnami/minio:2024.3.30
options: >- options: >-
@ -85,6 +89,7 @@ jobs:
RACE_ENABLED: 'true' RACE_ENABLED: 'true'
TAGS: bindata TAGS: bindata
TEST_REDIS_SERVER: redis:6379 TEST_REDIS_SERVER: redis:6379
TEST_ELASTICSEARCH_URL: http://elasticsearch:9200
test-mysql: test-mysql:
if: ${{ !startsWith(vars.ROLE, 'forgejo-') }} if: ${{ !startsWith(vars.ROLE, 'forgejo-') }}
runs-on: docker runs-on: docker

View file

@ -48,8 +48,8 @@ const (
{ {
"mappings": { "mappings": {
"properties": { "properties": {
"id": { "type": "integer", "index": true }, "id": { "type": "long", "index": true },
"repo_id": { "type": "integer", "index": true }, "repo_id": { "type": "long", "index": true },
"is_public": { "type": "boolean", "index": true }, "is_public": { "type": "boolean", "index": true },
"title": { "type": "text", "index": true }, "title": { "type": "text", "index": true },
@ -58,22 +58,22 @@ const (
"is_pull": { "type": "boolean", "index": true }, "is_pull": { "type": "boolean", "index": true },
"is_closed": { "type": "boolean", "index": true }, "is_closed": { "type": "boolean", "index": true },
"label_ids": { "type": "integer", "index": true }, "label_ids": { "type": "long", "index": true },
"no_label": { "type": "boolean", "index": true }, "no_label": { "type": "boolean", "index": true },
"milestone_id": { "type": "integer", "index": true }, "milestone_id": { "type": "long", "index": true },
"project_id": { "type": "integer", "index": true }, "project_id": { "type": "long", "index": true },
"project_board_id": { "type": "integer", "index": true }, "project_board_id": { "type": "long", "index": true },
"poster_id": { "type": "integer", "index": true }, "poster_id": { "type": "long", "index": true },
"assignee_id": { "type": "integer", "index": true }, "assignee_id": { "type": "long", "index": true },
"mention_ids": { "type": "integer", "index": true }, "mention_ids": { "type": "long", "index": true },
"reviewed_ids": { "type": "integer", "index": true }, "reviewed_ids": { "type": "long", "index": true },
"review_requested_ids": { "type": "integer", "index": true }, "review_requested_ids": { "type": "long", "index": true },
"subscriber_ids": { "type": "integer", "index": true }, "subscriber_ids": { "type": "long", "index": true },
"updated_unix": { "type": "integer", "index": true }, "updated_unix": { "type": "long", "index": true },
"created_unix": { "type": "integer", "index": true }, "created_unix": { "type": "long", "index": true },
"deadline_unix": { "type": "integer", "index": true }, "deadline_unix": { "type": "long", "index": true },
"comment_count": { "type": "integer", "index": true } "comment_count": { "type": "long", "index": true }
} }
} }
} }

View file

@ -14,8 +14,7 @@ import (
) )
func TestElasticsearchIndexer(t *testing.T) { func TestElasticsearchIndexer(t *testing.T) {
t.Skip("elasticsearch not found in Forgejo test yet") // The elasticsearch instance started by testing.yml > test-unit > services > elasticsearch
// The elasticsearch instance started by pull-db-tests.yml > test-unit > services > elasticsearch
url := "http://elastic:changeme@elasticsearch:9200" url := "http://elastic:changeme@elasticsearch:9200"
if os.Getenv("CI") == "" { if os.Getenv("CI") == "" {