# How are double-quotes put into a bulk string (for POSTing)?

**URL:** <https://discuss.elastic.co/t/how-are-double-quotes-put-into-a-bulk-string-for-posting/342064>\
**Category:** Elasticsearch\
**Created:** [August 31, 2023, 3:04pm UTC](https://discuss.elastic.co/t/how-are-double-quotes-put-into-a-bulk-string-for-posting/342064 "2023-08-31T15:04:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrodent](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@mrodent](https://discuss.elastic.co/u/mrodent)\
**Post date:** [August 31, 2023, 3:04pm UTC](https://discuss.elastic.co/t/how-are-double-quotes-put-into-a-bulk-string-for-posting/342064/1 "2023-08-31T15:04:35Z")

</div>

I'm trying to populate an index with bulk data.

In fact this data is being generated by a Rust crate, docx-rs, and this escapes double-quotes by putting a backslash in front of them. So, where one field of my (Lucene) document is "ldoc\_text", a part of the bulk string looks like this:

```auto
...
{"ldoc_text": "- Under menu Tools there is an item \"Synchronise now\". However I think the general idea is that everything happens automatically in the background.
- The result of doing this is that many new items appear to have been added to the bookmarks menu:
- \"OPERATIVE contacts\" was the first item on the menu before this syncing, with \"How can I make scrollbars thicker and easier\" the first under the first horizontal line...
...

```

... where "Synchronise now" and "OPERATIVE contacts" should be in double-quotes in the indexed text.

Is this right for an ES bulk string for POSTing? Is there somewhere in the documentation I should be able to find this info?

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [September 1, 2023, 9:38am UTC](https://discuss.elastic.co/t/how-are-double-quotes-put-into-a-bulk-string-for-posting/342064/2 "2023-09-01T09:38:27Z")

</div>

Hi @mrodent,

As you have in your query escaping the quotes using a backslash (`\"`) should be the right way to go. There is a similar discussion thread [here](https://discuss.elastic.co/t/escape-double-quotes-query-error-with-curl/166139) which gives the same answer.

This should apply to a bulk request as well. Are you getting a particular error?

---

<div class="post-metadata">

**Author:** ![mrodent](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@mrodent](https://discuss.elastic.co/u/mrodent)\
**Post date:** [September 1, 2023, 5:27pm UTC](https://discuss.elastic.co/t/how-are-double-quotes-put-into-a-bulk-string-for-posting/342064/3 "2023-09-01T17:27:29Z")

</div>

Thanks. No error as yet. Just rewriting (in Rust) and it'll be a short while before I put it to the test. Couldn't recall what worked before in Python.

A bit disappointed that something like this wouldn't actually be documented somewhere (maybe it is). A bit of searching suggests this is the JSON convention though.

---

<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:** [September 29, 2023, 5:27pm UTC](https://discuss.elastic.co/t/how-are-double-quotes-put-into-a-bulk-string-for-posting/342064/4 "2023-09-29T17:27:46Z")

</div>

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