Skip to content

Commit

Permalink
Updated documentation for plugins.query.field_type_tolerance
Browse files Browse the repository at this point in the history
Signed-off-by: Norman Jordan <norman.jordan@improving.com>
  • Loading branch information
normanj-bitquill committed Oct 28, 2024
1 parent 5dafb2f commit ffa1bc6
Showing 1 changed file with 31 additions and 35 deletions.
66 changes: 31 additions & 35 deletions docs/user/admin/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -833,46 +833,42 @@ Description
This setting controls whether preserve arrays. If this setting is set to false, then an array is reduced
to the first non array value of any level of nesting.

If you have an index with the following value for a field::
1. The default value is true (preserve arrays)
2. This setting is node scope
3. This setting can be updated dynamically

[
[
{"name": "one", "value": 1},
{"name": "two", "value": 2},
3
]
]
Querying a field containing array values will return the full array values::

With plugins.query.field_type_tolerance set to true, the array is returned in full::
os> SELECT accounts FROM people;
fetched rows / total rows = 1/1
+-----------------------+
| accounts |
+-----------------------+
| [{'id': 1},{'id': 2}] |
+-----------------------+

[
[
{"name": "one", "value": 1},
{"name": "two", "value": 2},
3
]
]
Disable field type tolerance::

With plugins.query.field_type_tolerance set to false, the array is reduced::
>> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_query/settings -d '{
"transient" : {
"plugins.query.field_type_tolerance" : false
}
}'

{"name": "one", "value": 1}
When field type tolerance is disabled, arrays are collapsed to the first non array value::

1. The default value is true (preserve arrays)
2. This setting is node scope
3. This setting can be updated dynamically
os> SELECT accounts FROM people;
fetched rows / total rows = 1/1
+-----------+
| accounts |
+-----------+
| {'id': 1} |
+-----------+

Update Settings Request::
Reenable field type tolerance::

sh$ curl -sS -H 'Content-Type: application/json' -X PUT 'localhost:9200/_cluster/settings?pretty' \
... -d '{"transient":{"plugins.query.field_type_tolerance":"false"}}'
{
"acknowledged": true,
"persistent": {},
"transient": {
"plugins": {
"query": {
"field_type_tolerance": "false"
}
}
}
}
>> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_query/settings -d '{
"transient" : {
"plugins.query.field_type_tolerance" : true
}
}'

0 comments on commit ffa1bc6

Please sign in to comment.