# Need suitable method like writeValueAsString (boolQueryWrapper) in ObjectMapper class for prepare query with out quotes for value

**URL:** <https://discuss.elastic.co/t/need-suitable-method-like-writevalueasstring-boolquerywrapper-in-objectmapper-class-for-prepare-query-with-out-quotes-for-value/111763>\
**Category:** Elasticsearch\
**Created:** [December 14, 2017, 12:11pm UTC](https://discuss.elastic.co/t/need-suitable-method-like-writevalueasstring-boolquerywrapper-in-objectmapper-class-for-prepare-query-with-out-quotes-for-value/111763 "2017-12-14T12:11:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![skodari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skodari/32/19875_2.png) [@skodari](https://discuss.elastic.co/u/skodari)\
**Post date:** [December 14, 2017, 12:11pm UTC](https://discuss.elastic.co/t/need-suitable-method-like-writevalueasstring-boolquerywrapper-in-objectmapper-class-for-prepare-query-with-out-quotes-for-value/111763/1 "2017-12-14T12:11:05Z")

</div>

Hi Team,

I have prepared this query to fetch docs from one index.

```
GET iso_country_index/_search?size=2000
{
    "query" : {
        "bool" : {
            "must" : [{
                "terms" : { 
                    "country_cde" : [44,99,20,24]
                }
            }]
        }
    }
}

```

As part of I'm java client I am using this method to create a query with code

### [luminis-ams/elastic-rest-spring-wrapper](https://github.com/luminis-ams/elastic-rest-spring-wrapper)

this ObjectMapper.writeValueAsString(boolQueryWrapper) returns query as

> GET iso\_country\_index/\_search?size=2000  
> {  
> "query" : {  
> "bool" : {  
> "must" : [{  
> "terms" : {  
> "country\_cde" : "[44,99,20,24]"  
> }  
> }]  
> }  
> }  
> }

here I'm getting " " for list --\> "country\_cde" : "[44,99,20,24]" instead of "country\_cde" :  
[44,99,20,24]  
so I am getting error .

Thanks in advnace

---

<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:** [January 11, 2018, 12:11pm UTC](https://discuss.elastic.co/t/need-suitable-method-like-writevalueasstring-boolquerywrapper-in-objectmapper-class-for-prepare-query-with-out-quotes-for-value/111763/2 "2018-01-11T12:11:33Z")

</div>

Closed on January 11, 2018, 12:11pm UTC

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