Skip to content

[FEATURE] Enhance search command to support free text and wildcards. #4007

Closed

Description

@vamsimanohar

Requirements

Support following types of queries.

  • Searching for terms and phrases with out field value.
    • search User Not Found
    • search "User Not Found"
  • Searching with wildcard characters
    • search ccnumber="4232*1232" H*l*o

Activity

  1. added
    enhancement
    on Aug 7, 2025
  2. self-assigned this
    on Aug 7, 2025
  3. penghuo commented on Sep 2, 2025

    @penghuo
    Collaborator

    Search command required search field is indexed as a text type, with all punctuation and spaces preserved in the index. e.g.

    ###
    PUT {{baseUrl}}/log00001
    Content-Type: application/x-ndjson
    
    {
      "settings": {
        "analysis": {
          "analyzer": {
            "bicla": {
              "type": "custom",
              "tokenizer": "my_tokenizer"
            }
          },
          "tokenizer": {
            "my_tokenizer": {
              "type": "pattern",
              "pattern": "(\\w+)|(\\p{Punct})|(\\s)",
              "group": 0
            }
          }
        }
      },
      "mappings": {
        "properties": {
          "message": {
            "type": "text",
            "analyzer": "bicla"
          }
        }
      }
    }
    
    ###
    POST {{baseUrl}}/log00001/_bulk
    Content-Type: application/x-ndjson
    
    { "index": { "_id": 1 } }
    {"message": "[2025-08-26] logtype=ws:access error"}
    { "index": { "_id": 2 } }
    {"message": "[2025-08-26] logtype!=ws:access this is unexpected"}
    { "index": { "_id": 3 } }
    {"message": "[2025-08-26] ws:access logtype this is unexpected"}
    { "index": { "_id": 4 } }
    {"message": "[2025-08-26] logtype=ws:access   error"}
    
    
    ### Return Doc1 and Doc4
    POST {{baseUrl}}/log00001/_search
    Content-Type: application/json
    
    {
      "query": {
        "match_phrase": {
          "message": {
            "query": "logtype=ws:access"
          }
        }
      }
    }
    
    ### Return Doc1
    POST {{baseUrl}}/log00001/_search
    Content-Type: application/json
    
    {
      "query": {
        "match_phrase": {
          "message": {
            "query": "logtype=ws:access error"
          }
        }
      }
    }
    
    ### Return Doc2
    POST {{baseUrl}}/log00001/_search
    Content-Type: application/json
    
    {
      "query": {
        "match_phrase": {
          "message": {
            "query": "logtype!=ws:access"
          }
        }
      }
    }
    
    ### Return Doc4
    POST {{baseUrl}}/log00001/_search
    Content-Type: application/json
    
    {
      "query": {
        "match_phrase": {
          "message": {
            "query": "logtype=ws:access   error"
          }
        }
      }
    }
    
  4. moved this from Not Started to Done in PPL Trackeron Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementv3.3.0

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions