Skip to content

[Main Feature] | Debug logging of OpenSearch queries #13137

Description

@jacksgt

Valid Title

  • I have updated the title to accurately reflect the bug description

Description

For full-text search capabilities, OJS supports two search drivers (engines): database and opensearch.
For the database search driver, a verbose query log can be enabled by setting [database] debug = On.
Unfortunately, at the moment no such option is available when using the opensearch search driver.

Having such an option would be immensely helpful for general troubleshooting (is my search indexing working? how many queries are sent to OpenSearch?) and in particular performance optimization (how long do OpenSearch queries take?).

The OpenSearch-PHP module supports specifying a middleware that can log queries as they are executed:

    $logger = new \Monolog\Logger('opensearch');
        $log_middleware = new \GuzzleLogMiddleware\LogMiddleware($logger);

        // Simple Setup
        $this->client = (new \OpenSearch\GuzzleClientFactory())->create([
            'base_uri' => 'https://localhost:9200',
            'auth' => ['admin', getenv('OPENSEARCH_PASSWORD')],
            'verify' => false, // Disables SSL verification for local development.
            'middleware' => [
                'gmponos/guzzle_logger' => $log_middleware,
            ],
        ]);

https://github.com/opensearch-project/opensearch-php/blob/main/USER_GUIDE.md

Steps to Reproduce

  1. Enable opensearch search driver

Expected Result

A debug or verbose option is available to logs all outgoing queries (read/write), the result (or a summary therefore) and timing information.

Actual Result

No option is available for viewing OpenSearch queries performed by OJS.

Environment Details

No response

Application Version

OJS master (79a51638a0bbb899d186a8a9ff6f207b9ec24a3a)

Logs

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions