-
Notifications
You must be signed in to change notification settings - Fork 22
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
Plugins PoC - Kotlin #233
Comments
LicensesGradle task
Plugin development roadmapCreate routes
|
I'm currently trying to index data with the following method: public static void populateData(Client client) {
client.index(
new IndexRequest(HELLO_WORLD_INDEX_NAME).id("test_id")
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
.source("{ \"field\": value }", XContentType.JSON)
).actionGet();
} But this seems to be blocking the whole of opensearch's engine: Caused by: java.lang.AssertionError: Expected current thread [Thread[#63,opensearch[integTest-0][transport_worker][T#3],5,main]] to not be a transport thread. Reason: [Blocking operation] |
It seems there is an action class that already handles indexing data from a REST API call: |
Having this issue on java.lang.AssertionError: Returned a 201 CREATED but not set up to support a Location header |
I finally managed to get the POST endpoint working without errors. The endpoint receives the Task data in JSON format and stores it in the
As a result, http://localhost:9200/tasks/_search returns: {
"took": 211,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "tasks",
"_id": "qLloCJABfI4fIpO-1tC7",
"_score": 1,
"_source": {
"document_id": null,
"title": "",
"description": "",
"is_completed": false
}
},
{
"_index": "tasks",
"_id": "qblsCJABfI4fIpO-Y9DY",
"_score": 1,
"_source": {
"document_id": 112,
"title": "",
"description": "",
"is_completed": false
}
}
]
}
} I'll be implementing the rest of the endpoints, tests and redacting a documentation about how to properly implement a REST plugin. |
Description
To better understand how plugins work, their lifecylce, how they interact with core functionalities and how to develop them in general, we are going to develop a simple plugin for
wazuh-indexer
that exposes an API to manage ToDos, as a proof of concept. We'll use Kotlin as the programming language.As a definition of done, we expect to have an API from which it's possible to:
ToDo model
The ToDos will be stored using an index, for example:
wazuh-todos
. Each of the documents in the index could have these properties:id
: uuidtitle
: stringdescription
: textdue_date
: dateThe index name and its fields must follow the naming convention.
Tasks
The text was updated successfully, but these errors were encountered: