include_contents index parameter

Enable the include_contents index parameter to index JSON or BSON documents as unstructured text as well as indexing the documents as field name-value pairs.

You can enable the include_contents index parameter if the all_json_names parameter is enabled or the json_names parameter is specified.

By default, both field names and values are indexed in the contents field. If you enable the only_json_values index parameter, only the values are indexed in the contents field.

Example: Index all fields as field name-value pairs and unstructured text

The following statement creates a bts index with the all_json_names and include_contents index parameters enabled on the example JSON docs column:

CREATE INDEX bts_idx
          ON json_tab (docs bts_json_ops)
       USING bts(
                 all_json_names="yes", 
                 include_contents="yes"); 

The resulting index contains the following 9 field name-value pairs, and the field names and values as unstructured text in the contents field:

givenname: jim
givenname: slim 
givenname: lynn
age: 29
cars: dodge
cars: olds
surname: flynn
surname: flynn
surname: kim
contents: person givenname jim surname flynn age 29 cars dodge olds 
parents givenname slim surname flynn givenname lynn surname kim

Example: Index specified field name-value pairs, paths, and values as unstructured text

The following statement creates a bts index with the json_names, json_path_processing, only_json_values, and include_contents index parameters enabled on the example JSON docs column:

create index bts_idx 
          on json_tab (docs bts_json_ops) 
       using bts(
                 json_names="(person.givenname,parents.surname)",
                 json_path_processing="yes",
                 include_contents="yes",
                 only_json_values="yes"); 

The resulting index contains four fields: three field name-value pairs with paths and the unstructured text in the contents field:

person.givenname: jim
parents.surname: flynn
parents.surname: kim
contents: jim flynn 29 dodge olds slim flynn lynn kim