使用索引器在Azure搜索服务中创建集合 [英] Creating Collection in Azure Search Service using Indexer

查看:107
本文介绍了使用索引器在Azure搜索服务中创建集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用索引器将数据从我的SQL数据库同步到Azure搜索服务.我的SQL视图中有一个字段,其中包含XML数据.列包含字符串列表.集合(Edm.String)中我的Azure搜索服务索引中的对应字段. 在检查一些文档时,我发现Indexer不会将Xml(SQL)更改为Collection(Azure Search). 关于如何从Xml数据创建集合的方法,是否有任何解决方法?

I am using indexer to sync data from my SQL Database to Azure Search Service. I have a field in my SQL View, which contains XML data. The Column contains a list of string. The corresponding field in my Azure Search Service Index in a Collection(Edm.String). On checking some documentations, I found that Indexer does not change Xml(SQL) to Collection(Azure Search). Is there any workaround as to how I can get create the Collection from the Xml data?

p.s我正在从View中提取数据,因此可以根据需要将Xml更改为JSON.

p.s I am extracting the data from a View, so I can change the Xml to JSON if needed.

推荐答案

2016年10月17日更新: Azure搜索现在自动将来自数据库的字符串转换为Collection(Edm.String)字段,如果数据代表JSON字符串数组:,例如["blue", "white", "red"]

UPDATE on October 17, 2016: Azure Search now automatically converts a string coming from a database to an Collection(Edm.String) field if the data represents a JSON string array: for example, ["blue", "white", "red"]

旧的响应:很好的时机,我们刚刚添加了一个新的字段映射"功能,使您可以执行此操作.此功能将在下周初的某个时候部署.当此线程在所有数据中心中推出时,我将对此线程发表评论.

Old response: great timing, we just added a new "field mappings" feature that allows you to do this. This feature will be deployed sometime early next week. I will post a comment on this thread when this is rolled out in all datacenters.

要使用它,您确实需要使用JSON.确保您的源列包含JSON数组,例如["hello""world"].然后,更新索引器定义以包含新的fieldMappings属性:

To use it, you indeed need to use JSON. Make sure your source column contains a JSON array, for example ["hello" "world"]. Then, update your indexer definition to contain the new fieldMappings property:

"fieldMappings" : [ { "sourceFieldName" : "YOUR_SOURCE_FIELD", "targetFieldName" : "YOUR_TARGET_FIELD", "mappingFunction" : { "name" : "jsonArrayToStringCollection" } } ]

注意:您需要使用API​​版本2015-02-28-Preview来添加fieldMappings.

NOTE: You'll need to use API version 2015-02-28-Preview to add fieldMappings.

HTH, 尤金

这篇关于使用索引器在Azure搜索服务中创建集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆