Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(opensearch): add additional global search filters and create sessionizer indexes for local #6352

Merged
merged 2 commits into from
Oct 19, 2024

Conversation

tsdk02
Copy link
Contributor

@tsdk02 tsdk02 commented Oct 17, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Global search has two components:

  • Free flow search, wherein search takes place across all fields available to search upon
  • Search on a specific field based on the field filter

In this PR, additional filters have been added for global search to search on a specific field.
A list of values can be provided for every filter field which will be added to the query in order to extract responses from opensearch / elasticsearch.
Existing filters (fields):

  • payment_method
  • currency
  • status
  • customer_email
  • search_tags

New filters added (fields):

  • connector
  • payment_method_type
  • card_network
  • card_last_4
  • payment_id

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Enhance search experience on global search using filters

How did you test it?

The following filters can be used to be searched upon:

  • connector
  • payment_method_type
  • card_network
  • card_last_4
  • payment_id

Hit the following curl for the /search API

curl --location 'http://localhost:8080/analytics/v1/search' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTQ5ZTNkMmItMTY5Yi00NzUzLWJmNTQtZDcxMTM2YjRiN2JkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzI2MDQ2MzI4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTcyOTI0ODM1MCwib3JnX2lkIjoib3JnX1ZwU0hPanNZZkR2YWJWWUpnQ0FKIiwicHJvZmlsZV9pZCI6InByb192NXNGb0hlODBPZWlVbElvbm9jTSJ9.TQD6wYkiTXlTvPW3-mH8FzEP1d7hXw9SmWgjVMH7flk' \
--header 'sec-ch-ua: "Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '{
    "query": "merchant_1726046328",
    "filters": {
        "payment_method": [
            "card"
        ]
    },
    "timeRange": {
        "startTime": "2024-09-13T00:30:00Z",
        "endTime": "2024-10-18T21:45:00Z"
    }
}'

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@tsdk02 tsdk02 added C-feature Category: Feature request or enhancement A-Analytics labels Oct 17, 2024
@tsdk02 tsdk02 self-assigned this Oct 17, 2024
@tsdk02 tsdk02 requested review from a team as code owners October 17, 2024 12:27
Copy link

semanticdiff-com bot commented Oct 17, 2024

Review changes with SemanticDiff.

Analyzed 4 of 9 files.

Filename Status
✔️ crates/router/src/consts/opensearch.rs Analyzed
✔️ crates/api_models/src/analytics/search.rs Analyzed
✔️ crates/analytics/src/opensearch.rs Analyzed
✔️ crates/analytics/src/search.rs Analyzed
config/config.example.toml Unsupported file format
config/development.toml Unsupported file format
config/docker_compose.toml Unsupported file format
config/vector.yaml Unsupported file format
config/deployments/env_specific.toml Unsupported file format

@tsdk02 tsdk02 changed the title feat(opensearch): added additional filters and created sessionizer indexes feat(opensearch): add additional filters and create sessionizer indexes for local Oct 17, 2024
@tsdk02 tsdk02 changed the title feat(opensearch): add additional filters and create sessionizer indexes for local feat(opensearch): add additional global search filters and create sessionizer indexes for local Oct 18, 2024
lsampras
lsampras previously approved these changes Oct 18, 2024
@tsdk02 tsdk02 dismissed stale reviews from ShivanshMathurJuspay and lsampras via ed83111 October 18, 2024 10:41
@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 19, 2024
Merged via the queue into main with commit 2e6cd6d Oct 19, 2024
15 of 17 checks passed
@likhinbopanna likhinbopanna deleted the add-filters-global-search branch October 19, 2024 14:22
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-Analytics C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(opensearch): add additional filters and create sessionizer indexes for local
4 participants