I am migrating from ElasticSearch to MySQL. My current ElasticSearch is using "ignore_above" : 256
for some fields.
Checking documentation https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-above.html
Strings longer than the ignore_above setting will not be indexed or stored.
How to accurately emulate this on (My)SQL level? Is there other option than TRIGGER that
- checks length of given field
- replaces the value with empty value if length>256?
CodePudding user response:
ignore_above: 256
means that if the length of your field is more than 256
it won't be searchable (indexed or stored), but still would be possible to return it in _source
field.
All strings/array elements will still be present in the _source field, if the latter is enabled which is the default in Elasticsearch.
To have the same behavior in MySQL you would still need to store the value of the field in your table as a TEXT
because you eventually want to return the value if it is matching the id of your document for example.