Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

api: implement fuzzy search API #10184

Merged
merged 3 commits into from
Apr 20, 2021
Merged

api: implement fuzzy search API #10184

merged 3 commits into from
Apr 20, 2021

Commits on Apr 16, 2021

  1. api: implement fuzzy search API

    This PR introduces the /v1/search/fuzzy API endpoint, used for fuzzy
    searching objects in Nomad. The fuzzy search endpoint routes requests
    to the Nomad Server leader, which implements the Search.FuzzySearch RPC
    method.
    
    Requests to the fuzzy search API are based on the api.FuzzySearchRequest
    object, e.g.
    
    {
      "Text": "ed",
      "Context": "all"
    }
    
    Responses from the fuzzy search API are based on the api.FuzzySearchResponse
    object, e.g.
    
    {
      "Index": 27,
      "KnownLeader": true,
      "LastContact": 0,
      "Matches": {
        "tasks": [
          {
            "ID": "redis",
            "Scope": [
              "default",
              "example",
              "cache"
            ]
          }
        ],
        "evals": [],
        "deployment": [],
        "volumes": [],
        "scaling_policy": [],
        "images": [
          {
            "ID": "redis:3.2",
            "Scope": [
              "default",
              "example",
              "cache",
              "redis"
            ]
          }
        ]
      },
      "Truncations": {
        "volumes": false,
        "scaling_policy": false,
        "evals": false,
        "deployment": false
      }
    }
    
    The API is tunable using the new server.search stanza, e.g.
    
    server {
      search {
        fuzzy_enabled   = true
        limit_query     = 200
        limit_results   = 1000
        min_term_length = 5
      }
    }
    
    These values can be increased or decreased, so as to provide more
    search results or to reduce load on the Nomad Server. The fuzzy search
    API can be disabled entirely by setting `fuzzy_enabled` to `false`.
    shoenig committed Apr 16, 2021
    Configuration menu
    Copy the full SHA
    350d9eb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ab92667 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    068fd43 View commit details
    Browse the repository at this point in the history