文本文件上的Azure搜索

时间:2019-02-18 19:47:51

标签: azure-search

尝试在具有文本文件的blob容器上设置Azure搜索。

我已经创建了一个存储帐户,并且正在使用存储在Blob容器中的Azure Data Lake gen2。我正在测试天蓝色搜索时,我只有一个文件。我已经创建了索引,数据源,当我尝试创建索引器时,我得到了

{"error":{"code":"","message":"Error with data source: The remote server returned an error: (400) Bad Request.  Please adjust your data source definition in order to proceed."}}

我的文件没有标题,包含16列,并且用竖线分隔 所以这是我尝试索引的内容

{
    "name" : "test-index",
    "fields": [
        { "name": "id", "type": "Edm.String", "key": true, "searchable": false },
        {"name":"TransactionId", "type": "Edm.String", "key": false, "searchable": true },
        {"name":"TransactionEventId", "type": "Edm.String", "key": false, "searchable": true },
        {"name":"EventTypeId", "type": "Edm.String", "key": false, "searchable": true },
        {"name":"EventSourceId", "type": "Edm.String", "key": false, "searchable": true },
        {"name":"SourceUserId", "type": "Edm.String", "key": false, "searchable": true },
        {"name":"SourceRecordId", "type": "Edm.String", "key": false, "searchable": true },
        {"name":"SourceDetails", "type": "Edm.String", "key": false, "searchable": true },
        {"name":"UserGlobalId", "type": "Edm.Int32", "key": false, "searchable": false },
        {"name":"CallDistributorKey", "type": "Edm.Int32", "key": false, "searchable": false },
        {"name":"CreatedDateTime", "type": "Edm.DateTimeOffset", "key": false, "searchable": false },
        {"name":"AccountId", "type": "Edm.Int32", "key": false, "searchable": false },
        {"name":"LobId", "type": "Edm.Int32", "key": false, "searchable": false },
        {"name":"StartEvent", "type": "Edm.Int32", "key": false, "searchable": false },
        {"name":"EndEvent", "type": "Edm.Int32", "key": false, "searchable": false },
        {"name":"OnCall", "type": "Edm.Int32", "key": false, "searchable": false },
        {"name":"PresenceEventId", "type": "Edm.Int32", "key": false, "searchable": false },
        {"name":"EventProcessedUtcTime", "type": "Edm.DateTimeOffset", "key": false, "searchable": false }
    ]
}


---also tried something much simpler
 "fields": [
        { "name": "id", "type": "Edm.String", "key": true, "searchable": false },
        { "name": "content", "type": "Edm.String",  "key":false, "retrievable": false , "filterable": false, "sortable": false, "facetable":false, "searchable": true}
    ]

--datasource 
{
"name" : "test-ds", 
"type" : "azureblob", 
"credentials" : { "connectionString" :"DefaultEndpointsProtocol=https;AccountName=......;AccountKey=..." }, 
"container" : { "name" : "test" }
}

--indexer
{   
  "name" : "test-indexer",  
  "dataSourceName" : "test-ds",
  "targetIndexName" : "test-index"
}

---get error 
{"error":{"code":"","message":"Error with data source: The remote server returned an error: (400) Bad Request.  Please adjust your data source definition in order to proceed."}}

--tried this indexer create as well
{   
  "name" : "test-indexer",  
  "dataSourceName" : "test-ds",
  "targetIndexName" : "test-index",
   "parameters" : { "configuration" : { "parsingMode" : "delimitedText", "delimitedTextDelimiter" : "|" , "delimitedTextHeaders" : "TransactionId
TransactionEventId,EventTypeId,EventSourceId,SourceUserIdSourceRecordId,
SourceDetails,UserGlobalId,CallDistributorKey,CreatedDateTime,AccountId,
LobId,StartEvent,EndEvent,OnCall,PresenceEventId,EventProcessedUtcTime" } }
}

---get error 
{"error":{"code":"","message":"Error with data source: The remote server returned an error: (400) Bad Request.  Please adjust your data source definition in order to proceed."}}

任何指针都很棒。...

1 个答案:

答案 0 :(得分:1)

这是Azure Data Lake Storage Gen2和Blob存储之间的API互操作性的existing issue

Azure Search使用Blob存储API,并且这些API当前与分层名称空间不兼容。您可以禁用分层名称空间功能来启用Azure搜索索引,但是您将丢失一些Azure Data Lake Storage Gen2 specific features