Azure SQL查看问题的Azure搜索

时间:2017-05-29 17:56:15

标签: azure azure-sql-database

首先我在Azure SQL中创建了View:

SELECT
    [P].[Id]
FROM [dbo].[table1] [P]
LEFT JOIN [dbo].[tabl2] [PL] ON [P].[Id] = [PL].[Id]

总计数为1000行。

然后我创建了Azure搜索数据源

{
    "@odata.context": "https://....search.windows.net/$metadata#datasources/$entity",
    "name": "ds",
    "description": "",
    "type": "azuresql",
    "subtype": null,
    "credentials": {
        "connectionString": "..."
    },
    "container": {
        "name": "view_test",
        "query": null
    },
    "dataChangeDetectionPolicy": {
        "@odata.type": "#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy",
        "highWaterMarkColumnName": "Id"
    },
    "dataDeletionDetectionPolicy": null
}

然后Azure搜索索引

{
    "@odata.context": "....search.windows.net/$metadata#indexes/$entity",
    "name": "testing-index",
    "fields": [{
            "name": "Id",
            "type": "Edm.String",
            "searchable": true,
            "filterable": true,
            "retrievable": true,
            "sortable": true,
            "facetable": false,
            "key": true,
            "analyzer": null
        }
    ],
    "scoringProfiles": [],
    "defaultScoringProfile": "",
    "corsOptions": null
}

然后是Indexer

{
  "@odata.context": "https://....search.windows.net/$metadata#indexers/$entity",
  "name": "indexer-test",
  "description": "",
  "dataSourceName": "ds",
  "targetIndexName": "testing-index",
  "schedule": {
    "interval": "PT05M",
    "startTime": "2016-12-01T00:00:00Z"
  },
  "parameters": {
    "maxFailedItems": 0,
    "maxFailedItemsPerBatch": 0,
    "base64EncodeKeys": false
  }
}

当我检查Azure门户并查看索引器时,我看到文档成功1000.但索引DOCUMENT COUNT仅包含Azure SQL table1的总数

所以我尝试运行以下

https://....search.windows.net/indexes/testing-index/docs/$count?api-version=2016-09-01

我已经等了一天索引才能获得更新而没有运气。我按照相同的步骤使用Table而不是View,它起到了魅力作用。

问题得到解决。 Id不应该是关键。

0 个答案:

没有答案