Unable to load script under config/scripts


(Thomas) #1

Hi,

I'm trying to keep some scripts within config/scripts but elasticsearch
seems that it cannot locate them. What could be a possible reason for this?

When need to invoke it es fails with the following

No such property: for class: Script1

Any ideas?

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f96b90e4-7704-49e0-8dd6-38ef1ebe6558%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #2

Here's a basic example you can try:

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7b06ee42-7bd1-41ab-a2eb-560949a86158%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Chris H) #3

Thanks for posting the tutorial. I've been looking everywhere for this.
I'm able to succeed with your tutorial, but I cannot get subdirectories to work.

So this fails with the bolded modifications. Am I misunderstanding how to notate directories?

Step 1:
Under the config/scripts/hw folder, create a file named helloworld.mvel

Step 2:
Edit the file helloworld.mvel and put this and save:
"hello world"

Step 3:
Restart Elasticsearch

Step 4:
Test the script using a query like this:

curl -XPOST 'localhost:9200/test1/doc' -d '{ "test": "test" }'

curl 'localhost:9200/test1/_search?pretty' -d '{
"script_fields": {
"test": {
"script": "hw_helloworld"
}
}
}'


(system) #4