Skip to content

Script_File support for NEST #1456

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

Closed
clintongormley opened this issue Jun 14, 2015 · 3 comments
Closed

Script_File support for NEST #1456

clintongormley opened this issue Jun 14, 2015 · 3 comments

Comments

@clintongormley
Copy link
Contributor

From @vineet85 on June 14, 2015 20:15

Hi,

ElasticSearch supports referencing a script which is stored in a file. Eg:-
GET /_search
{
"script_fields": {
"my_field": {
"script_file": "my_script",
"params": {
"my_var": 2
}
}
}
}

However the .NET NEST client does not have any support for this yet. Is this going to be added soon?

public string ScriptId { get; set; }

Thanks,
Vineet

Copied from original issue: elastic/elasticsearch#11652

@isabel12
Copy link

This would be great - it is best practice to use stored scripts over anything else isn't it? (https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html)

It would be nice to be able to use scripts safely and disable dynamic scripting.

@gmarz gmarz closed this as completed in 66692b6 Jun 15, 2015
@gmarz
Copy link
Contributor

gmarz commented Jun 15, 2015

Just added. Thanks for reporting @vineet85

@gmarz gmarz added Bug labels Jun 15, 2015
@vineet85
Copy link

Can this be added to the BulkUpdateDescriptor as well?

https://github.com/elastic/elasticsearch-net/blob/4fcecae93dcf16a4ff7e110135da81eed409dda5/src/Nest/DSL/Bulk/BulkUpdateDescriptor.cs

Eg:-
BulkDescriptor childBulkDescriptor = new BulkDescriptor();

for (int i = 0; i < searchResponse.Hits.Count(); i++)
{
childBulkDescriptor.Update<NestedDocument, object>(u => u

  • .Type("document")*
  • .Id(searchResponse.Hits.ElementAt(i).Id) // document id*
  • .ScriptFile("my_script")*
  • .Params(x => x.Add("field_id", fieldIdToUpdate).Add("field_value",
    fieldValue))*
  • .RetriesOnConflict(4)*
  • );*
  • }*

Thanks,
Vineet

On Sun, Jun 14, 2015 at 10:16 PM, Greg Marzouka [email protected]
wrote:

Just added. Thanks for reporting @vineet85 https://github.com/vineet85


Reply to this email directly or view it on GitHub
#1456 (comment)
.

Vineet Saju

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

No branches or pull requests

4 participants