Search string-encoded JSON object

Hi,

Is it possible to create a FTS index for this kind of JSON data? For example, I want to perform FTS on the following fields

  • id
  • value.id (the id field within the value field)
  • value.messageHeader.string (the string field within the messageHeader object inside the value field)

Here is the sample data

{ 
       "id" : "outsideId_1234",
       "type" : "docType",
       "value" : "{\r\n  \"createdAt\": 1573523456133,\r\n  \"id\": \"innerId_5TBrT\",\r\n  \"type\": \"InnerObject\",\r\n   \"messageHeader\": {\r\n      \"summary\": null,\r\n      \"eventId\": {\r\n        \"string\": \"ff2d6d80-151f-425a-b5e9-7b99b1aab738\"\r\n      }\r\n}"
 }

If it is not possible to do so, is there anyway to make it so that the JSON data above can be searched?

Thanks

@Phuong_Hoang, the type of the “value” field is “text”, so by indexing the value field as “text” with an analyzer that uses the whitespace tokenizer - you should be able to search across its content. You could create a custom list of stop words that you wouldn’t want included.

However you won’t be able to use field names within “value” since it holds a string and not an object.

1 Like