# Extract request JSON from MultiGetRequestBuilder

**URL:** <https://discuss.elastic.co/t/extract-request-json-from-multigetrequestbuilder/11888>\
**Category:** Elasticsearch\
**Created:** [May 8, 2013, 11:41pm UTC](https://discuss.elastic.co/t/extract-request-json-from-multigetrequestbuilder/11888 "2013-05-08T23:41:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Mindenhall](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@Mark\_Mindenhall](https://discuss.elastic.co/u/Mark_Mindenhall)\
**Post date:** [May 8, 2013, 11:41pm UTC](https://discuss.elastic.co/t/extract-request-json-from-multigetrequestbuilder/11888/1 "2013-05-08T23:41:47Z")

</div>

Using the Java client, it's possible to obtain the generated request JSON  
from the SearchRequestBuilder merely by calling toString():

```
  LOGGER.debug("Executing query:\n" + searchRequestBuilder.toString());

```

We also have some code that uses the MultiGetRequestBuilder to retrieve  
specific documents by ID, so I added a line to do the same thing:

```
  LOGGER.debug("Executing query:\n" + multiGetRequestBuilder.toString

```

());

Problem is, MultiGetRequestBuilder does not override toString() to provide  
a similar capability. Is there another way to extract the JSON from the  
request builder? I haven't hit on anything so far. We're on version  
0.19.9. Any suggestions?

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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [May 9, 2013, 9:17pm UTC](https://discuss.elastic.co/t/extract-request-json-from-multigetrequestbuilder/11888/2 "2013-05-09T21:17:17Z")

</div>

I don't see it in the most recent version 0.90.0 either. ☹

On Wednesday, May 8, 2013 7:41:47 PM UTC-4, Mark Mindenhall wrote:

> Using the Java client, it's possible to obtain the generated request JSON  
> from the SearchRequestBuilder merely by calling toString():
> 
> ```
> LOGGER.debug("Executing query:\n" + searchRequestBuilder.toString
> 
> ```
> 
> ());
> 
> We also have some code that uses the MultiGetRequestBuilder to retrieve  
> specific documents by ID, so I added a line to do the same thing:
> 
> ```
> LOGGER.debug("Executing query:\n" + multiGetRequestBuilder.toString
> 
> ```
> 
> ());
> 
> Problem is, MultiGetRequestBuilder does not override toString() to provide  
> a similar capability. Is there another way to extract the JSON from the  
> request builder? I haven't hit on anything so far. We're on version  
> 0.19.9. Any suggestions?
> 
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 9, 2013, 10:06pm UTC](https://discuss.elastic.co/t/extract-request-json-from-multigetrequestbuilder/11888/3 "2013-05-09T22:06:31Z")

</div>

Can you open an issue?

I think we just need to add:

```
@Override
public String toString() {
    return internalBuilder().toString();
}

```

In MultiGetRequestBuilder and MultiSearchRequestBuilder as well.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 9 mai 2013 à 01:41, Mark Mindenhall [mmindenhall@gmail.com](mailto:mmindenhall@gmail.com) a écrit :

Using the Java client, it's possible to obtain the generated request JSON from the SearchRequestBuilder merely by calling toString():

```
  LOGGER.debug("Executing query:\n" + searchRequestBuilder.toString());

```

We also have some code that uses the MultiGetRequestBuilder to retrieve specific documents by ID, so I added a line to do the same thing:

```
  LOGGER.debug("Executing query:\n" + multiGetRequestBuilder.toString());

```

Problem is, MultiGetRequestBuilder does not override toString() to provide a similar capability. Is there another way to extract the JSON from the request builder? I haven't hit on anything so far. We're on version 0.19.9. Any suggestions?

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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:37am UTC](https://discuss.elastic.co/t/extract-request-json-from-multigetrequestbuilder/11888/4 "2017-07-06T02:37:15Z")

</div>


