Open mikemikhaylov opened 9 years ago
This is more an SQL for MSSQL question. Use something like
"sql":"select [Id] as '_id', cast [Logo] as varchar(...) from [dbo].[Table]"
Yes, but column type is alredy string. More specifically nvarchar(256). The thing is that if we for example modify value to json array [{"id":"image.jpg","width":100,"height":75}] It will be treated as a string "Logo": "[{\"id\":\"image.jpg\",\"width\":100,\"height\":75}]"
But unfortunately this culumn stores just single object as a string.
I found mention about that in https://github.com/jprante/elasticsearch-jdbc/issues/157 "fields that are valid JSON will be indexed as "object" type" Can this feature be disabled?
I see.
The feature is automatically enabled yet.
Disabling is possible - pull requests/patches are welcome.
@jprante What part of code that does this auto parsing? I am facing the same issue, and would like to disable it.
Hi,
I have a table in MS SQL that contains json data in one column named Logo. Something like that: {"id":"image.jpg","width":100,"height":75} The importer settings are: { "type" : "jdbc", "interval" : "1m",
"jdbc": [ { "url":"jdbc:sqlserver://localhost:1433;databaseName=Test", "user":"sa", "password":"pass", "sql":"select [Id] as '_id', Logo from [dbo].[Table]", "index" : "indexName", "type" : "typeName" }] }
And when I query this column from Elasticsearch, it looks like object "Logo": { "width": 100, "id": "image.jpg", "height": 75 }
And I can't figure out is there any way to force this column to be treated as a string. I really need it to be stored just like this: "Logo": "{\"id\":\"image.jpg\",\"width\":100,\"height\":75}"
Is it possible?
I'm using latest versions of elasticsearch-jdbc and ElasticSearch.
Thanks.