# Configuration

## Application Configuration

Content Insight can be configured by modifying the “application.properties” file in the config directory.

### Web Services Port

```
 # ---------- templates ---------------------
 spring.freemarker.template-loader-path= classpath:/templates/
 spring.freemarker.suffix= .ftl

 # ---------- server config ---------------------
 server.port=8081
 content-gateway.version=${project.version}
```

Update the server port for the REST API. Make sure the port is not in use otherwise the application will abort upon starting up.

### File upload

```
 # ---------- file upload ---------------------
 spring.http.multipart.max-file-size=128MB
 spring.http.multipart.max-request-size=128MB
 spring.servlet.multipart.max-file-size=128MB
 spring.servlet.multipart.max-request-size=128MB
```

Specify the maximum file size that can be uploaded using the web service.

### Index Store

```
# ---------- index storage ---------------------
content-insight.indexStore.nodes[0].host=localhost
content-insight.indexStore.nodes[0].port=9200
content-insight.indexStore.nodes[0].scheme=http 
content-insight.indexStore.username=aaa
content-insight.indexStore.password=bbb
content-insight.indexStore.bulkSize=1000
content-insight.indexStore.index=test-ecm
content-insight.indexStore.type=doc
```

Modify the index store information to match your storage configuration. The index (test-ecm is the sample above) will be created if it does not already exist.

### Search Configuration

```
 # ---------- search config ---------------------
 content-insight.searchConfig.numResults=100
 content-insight.searchConfig.dateFields=effective_date,last_update_date,expiration_date,scan_date
 content-insight.searchConfig.stringFields=id, documenttitle,dln,tax_year, tp_type, classified_cd, conf_code, form_type_cd, document_class
```

The search config settings are used to control the search parameters and results. For example, **numResults** specifies the upper limit of the number of records that the search will retrieve.

The **dateFields** indicate the date type fields specified in the raw metadata. These can be used for range queries.

The **stringFields** indicate the text fields that will be used in search. You can use these in the query parameters along with the text from the body of the document.

### Message Queue Configuration

```
# ---------- Queue Configuration ---------------------
## Queue Type - MQ, ActiveMQ
content-insight.qm.type= MQ
```

Content Insight supports ActiveMQ and IBM Websphere MQ. In the example below, we have selected  IBM MQ, as the queue manager type.

```
# Event Publishing Server Details
content-insight.mq.src.qm= MY_QRSRC_QM
content-insight.mq.src.host= localhost
content-insight.mq.src.port= 1416
content-insight.mq.src.channel= MY_QRSRC_SVRCONN
content-insight.mq.dest.qm= MY_QRSRC_QM
content-insight.mq.dest.host= localhost
content-insight.mq.dest.port= 1417
content-insight.mq.dest.channel= MY_QRSRC_SVRCONN
```

For IBM WebSphere MQ, specify the channel,  queue manager, host and port information for the both the source and destination.

```
## Queue Type - MQ, ActiveMQ
 content-insight.qm.type= ActiveMQ

 # ---------- ActiveMQ Config ---------------------
 content-insight.activemq.broker.url=tcp://localhost:61616
 content-insight.activemq.broker.username=admin
 content-insight.activemq.broker.password=admin
```

For ActiveMQ, specify the broker URL and credentials.

```
content-insight.src.queue.name= pdfIndexRequestQ
content-insight.dest.queue.name= pdfIndexResultQ
```

Finally specify the source queue name (from which the engine will read the input message) and destination queue name (to which the index result will be written).

#### Logging Configuration

The log files are managed using log4j2 XML configuration. The XML file can be located in the config directory.

```markup
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
    <Properties>
        <Property name="filename">%tmp%/content-insight.log</Property>
    </Properties>
    <Appenders>
        <Console name="console-log" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
        <File name="file-log" fileName="${filename}">
            <PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </File>
    </Appenders>
    <Loggers>
        <Logger name="io.invariant" level="debug" additivity="false">
            <AppenderRef ref="console-log"/>
            <AppenderRef ref="file-log" level="debug"/>
        </Logger>
        <Logger name="org.elasticsearch" level="error" additivity="false">
            <AppenderRef ref="console-log"/>
        </Logger>
        <Logger name="org.springframework" level="error" additivity="false">
            <AppenderRef ref="console-log"/>
        </Logger>
        <Root level="info">
            <AppenderRef ref="console-log"/>
            <AppenderRef ref="file-log"/>
        </Root>
    </Loggers>
</Configuration>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.invariant.io/content-insight/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
