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

Create index-template-commands on POST request #83

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

AlexRuiz7
Copy link
Member

Description

This PR implements the creation of the command's index template before indexing data to the index.

curl -XPOST "http://127.0.0.1:9200/_plugins/_commandmanager" -H 'Content-Type: application/json' -d'
{
  "command": {
    "source": "UsersServices",
    "user": "user13",
    "target": "WazuhServerCluster5",
    "type": "agent_group",
    "action": {
        "type": "Server cluster",
        "args": [
            "/path/to/executable/arg8"
        ],
        "version": "v4"
    },
    "timeout": 100
  }
}'

{"_index":".commands","_id":"Ez2tQ5IBwhioaNePRF5F","result":"CREATED"}% 
{
  ".commands": {
    "aliases": {

    },
    "mappings": {
      "date_detection": false,
      "properties": {
        "command": {
          "properties": {
            "action": {
              "properties": {
                "args": {
                  "type": "keyword",
                  "ignore_above": 1024
                },
                "type": {
                  "type": "keyword",
                  "ignore_above": 1024
                },
                "version": {
                  "type": "keyword",
                  "ignore_above": 1024
                }
              }
            },
            "order_id": {
              "type": "keyword",
              "ignore_above": 1024
            },
            "request_id": {
              "type": "keyword",
              "ignore_above": 1024
            },
            "result": {
              "properties": {
                "code": {
                  "type": "short"
                },
                "data": {
                  "type": "keyword",
                  "ignore_above": 1024
                },
                "message": {
                  "type": "keyword",
                  "ignore_above": 1024
                }
              }
            },
            "source": {
              "type": "keyword",
              "ignore_above": 1024
            },
            "status": {
              "type": "keyword",
              "ignore_above": 1024
            },
            "target": {
              "type": "keyword",
              "ignore_above": 1024
            },
            "timeout": {
              "type": "short"
            },
            "type": {
              "type": "keyword",
              "ignore_above": 1024
            },
            "user": {
              "type": "keyword",
              "ignore_above": 1024
            }
          }
        }
      }
    },
    "settings": {
      "index": {
        "replication": {
          "type": "DOCUMENT"
        },
        "refresh_interval": "5s",
        "hidden": "true",
        "number_of_shards": "1",
        "provided_name": ".commands",
        "query": {
          "default_field": [
            "command.source",
            "command.target",
            "command.status",
            "command.type"
          ]
        },
        "creation_date": "1727712281860",
        "number_of_replicas": "0",
        "uuid": "_DVNVtJnQN2K64lBd-BuZw",
        "version": {
          "created": "136377827"
        }
      }
    }
  }
}

Issues Resolved

Closes #42

@AlexRuiz7 AlexRuiz7 self-assigned this Sep 30, 2024
@AlexRuiz7 AlexRuiz7 requested a review from a team as a code owner September 30, 2024 16:16
@AlexRuiz7 AlexRuiz7 merged commit fcf48f3 into master Oct 1, 2024
@AlexRuiz7 AlexRuiz7 deleted the 42-create-commands-index-template branch October 1, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement commands index creation
2 participants