Skip to content

Commit

Permalink
chore: add mongodb compound indices
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreiffers committed Oct 9, 2023
1 parent abdef37 commit bede8cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/main/kotlin/no/fdk/concept_catalog/model/Begrep.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@ import org.springframework.data.elasticsearch.annotations.Field
import org.springframework.data.elasticsearch.annotations.FieldType
import org.springframework.data.elasticsearch.annotations.Mapping
import org.springframework.data.elasticsearch.annotations.Setting
import org.springframework.data.mongodb.core.index.CompoundIndex
import org.springframework.data.mongodb.core.index.CompoundIndexes
import org.springframework.data.mongodb.core.index.Indexed
import org.springframework.data.mongodb.core.mapping.Document
import java.time.Instant
import java.time.LocalDate

@Document(collection = "begrep")
@CompoundIndexes(value = [
CompoundIndex(name = "ansvarlig_virksomhet", def = "{'ansvarligVirksomhet.id' : 1}"),
CompoundIndex(name = "ansvarlig_virksomhet_status", def = "{'ansvarligVirksomhet.id' : 1, 'status': 1}"),
CompoundIndex(name = "originalt_begrep", def = "{'originaltBegrep' : 1}"),
CompoundIndex(name = "originalt_begrep_er_publisert", def = "{'originaltBegrep' : 1, 'erPublisert': 1}")
])
@org.springframework.data.elasticsearch.annotations.Document(indexName = "concepts")
@Setting(settingPath = "/elastic/settings.json")
@Mapping(mappingPath = "/elastic/mappings.json")
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ application:
---
spring:
config.activate.on-profile: develop
data.mongodb.uri: mongodb://admin:admin@localhost:27017/datasetCatalog?authSource=admin&authMechanism=SCRAM-SHA-1
data.mongodb:
uri: mongodb://admin:admin@localhost:27017/datasetCatalog?authSource=admin&authMechanism=SCRAM-SHA-1
auto-index-creation: true
security.oauth2.resourceserver.jwt.jwk-set-uri: https://sso.staging.fellesdatakatalog.digdir.no/auth/realms/fdk/protocol/openid-connect/certs
rabbitmq.host: 127.0.0.1
elasticsearch:
Expand Down

0 comments on commit bede8cb

Please sign in to comment.