# Http Request from painless script not working

**URL:** <https://discuss.elastic.co/t/http-request-from-painless-script-not-working/308876>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [July 5, 2022, 9:05am UTC](https://discuss.elastic.co/t/http-request-from-painless-script-not-working/308876 "2022-07-05T09:05:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mukesh\_154](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mukesh_154/32/100807_2.png) [@mukesh\_154](https://discuss.elastic.co/u/mukesh_154)\
**Post date:** [July 5, 2022, 9:05am UTC](https://discuss.elastic.co/t/http-request-from-painless-script-not-working/308876/1 "2022-07-05T09:05:20Z")

</div>

I want to create a runtime field based on some conditions. And i have a query which is working fine on kibana console. I implemented the same query on java code but is not working. There is a method in SearchRequest `runtimeMappings()` which is overloaded and can accepts `String key, List<RuntimeField> value` or can accepts `Map<String, List<RuntimeField>> map` . But when I am using any of these methods and running my query, it is throwing an exception: `Caused by: org.elasticsearch.index.mapper.MapperParsingException: Expected map for runtime field [w_ticket_category] definition but got a java.util.ArrayList`. This is happening because the ES expects `Map` instead of `List` in the value of these mathods. The query on kibana console taking value as a `Map` only and is working, and if I am trying to pass a `List` instead of `Map` then I am getting the same error.

UPDATE: I got a diff in which we can see the changes for that method. The `runtimeMappings(String key, RuntimeField value)` changed to `runtimeMappings(String key, List<RuntimeField> value)` and similarly `runtimeMappings(Map<String, RuntimeField> map)` changed to `runtimeMappings(Map<String, List<RuntimeField>> map)`.  
Is there any specific reason for it.  
[Github Diff Link](https://github.com/elastic/elasticsearch-java/commit/7444423055b1826b147a1c104d96793aee5281f8#diff-3ba9b5684e7ba0055f11a4351fa5bacd8c2632c346f95f45dad8c6c6b094cc12)  
Is it known issue or i'm doing something wrong...  
Any help would be appreciated.  
Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 2, 2022, 9:05am UTC](https://discuss.elastic.co/t/http-request-from-painless-script-not-working/308876/2 "2022-08-02T09:05:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
