Create a Index in ElasticSearch on Issue creation Edited


I am trying to create Index in ElasticSearch using REST API on Issue creation.

I had written Groovy script in Script Runner function but I am not able to create Index.

 I am trying to debug below script in Post function but it is not running.

Could anyone please help me out here. 


import groovy.json.JsonSlurper;
import groovy.json.StreamingJsonBuilder;

def body_req = [
    settings: [index:[number_of_shards:3,number_of_replicas:2]]
def baseURL = "http://localhost:9200/JiraTicket";
URL url;
url = new URL(baseURL);
URLConnection connection = url.openConnection() as HttpURLConnection;
connection.requestMethod = "PUT" 
connection.doOutput = true 
connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8")
connection.outputStream.withWriter("UTF-8") { new StreamingJsonBuilder(it, body_req) }

Thanks ,



0 answers

Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

494 views 6 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot