I have to convert this to an http invoke method to use in Nifi to index data into elasticsearch. any help is appreciated.
my elastcisearch url: http://localhost:9200/elastcsearch
POST /doc1/_update_by_query
{
"query": {
"term": {
"state_num": 4
}
},
"script": {
"inline": "ctx.\_source.documents.add(params.text)",
"params": {
"text": {
"number": "1",
"docs_content": "this text goes here"
}
}
}
}
any help is appreciated.
You can try the following method
Create an Invoke HTTP processor in NiFi.
Set the HTTP Method property to POST.
Set the Remote URL property to http://localhost:9200/doc1/_update_by_query.
Set the Content-Type property to application/json
.
In the body of the request, include the JSON payload of the original request:
{
"query": {
"term": {
"state_num": 4
}
},
"script": {
"inline": "ctx._source.documents.add(params.text)",
"params": {
"text": {
"number": "1",
"docs_content": "this text goes here"
}
}
}
}