Result records in Elasticsearch do not always have all columns
that are defined in an index.
This often happens when multiple document types are stored in the same index.
The first row has columns ["_id", "html", "url"], while the second
misses the "html" column: ["_id", "url"].
Adminer expects that all result rows include all columns.
This leads to the problem that the "url" value in the 2nd example row
was rendered in the "html" column.
This patch fixes this problem by fetching the actual column list first
when all fields are to be shown, and using that field list
as base for all rows.
1. Make values NULLable by default, so that empty values do not
get submitted to the Elasticsearch server.
This helps e.g. with empty date fields - Elasticsearch would try to
convert the field type to string when the value is an empty string,
but that fails when there are documents with properly filled date fields
2. Remove _id from the POST array because this is not allowed.
The server fails if it is included with
> mapper_parsing_exception:
> Field [_id] is a metadata field and cannot be added inside a document.
> Use the index API request parameters.
3. Use the correct URL to create a document: "$index/_doc/"
and "$index/_doc/$id". This is the same for ES 7 and 8:
- https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-index_.html#docs-index-api-request
- https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docs-index_.html#docs-index-api-request
4. Handle failed creations by checking for false
5. Return the "result" property string instead of the non-existing
"created" property.
When searching in all fields for a text value, an error was thrown
with ElasticSearch 7.17.23 when the index contains boolean fields:
> query_shard_exception: failed to create query:
> Can't parse boolean value [textvalue], expected [true] or [false]
This patch fixes that problem by skipping boolean fields when the
search word is not the string "true" or "false".