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

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:

...
{"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?

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 which gives the same answer.

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

1 Like

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.

1 Like

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