JamesMatson
JamesMatson

Reputation: 2922

Azure Search with CosmosDB data source shows documents in collection but Search Explorer shows all NULL or EMPTY values

I have a CosmosDb database with valid data documents within it. I have creatd an Azure Search and correctly hooked up the CosmosDB endpoint, and run the indexer which has indexed over 500 documents, with 149KB of storage used up. However, when I run a simple '*' search using Search Explorer, all my result sets are NULL except the primary key and another field from CosmosDb that gets internally generated whenever I add a new Document. What am I doing wrong? These fields are NOT null or empty in the database.

See below screenshots:

enter image description here

enter image description here

Showing the JSON from search explorer as well:

"value": [
    {
        "@search.score": 1,
        "id": "9ce19abc-a26a-5102-1919-8dcf42100067",
        "StoreName": "",
        "StoreProfile": "",
        "StoreType": "",
        "StoreStatus": "",
        "RBM": "",
        "StoreStateManager": "",
        "StoreFranchiseGroup": "",
        "Street": "",
        "City": "",
        "State": "",
        "Location": "",
        "Precinct": "",
        "AreaPopulation": "",
        "MedianAge": "",
        "MedianHHoldIncome": "",
        "Grading": "",
        "BayCount": "",
        "TenancySqm": "",
        "RetailAreaSqm": "",
        "rid": "BFA1AM5ZblIBAAAAAAAAAA=="
    },
    {
        "@search.score": 1,
        "id": "5fe1ec72-1cc9-593a-fac0-891f8b84df27",
        "StoreName": null,
        "StoreProfile": null,
        "StoreType": null,
        "StoreStatus": null,
        "RBM": null,
        "StoreStateManager": null,
        "StoreFranchiseGroup": null,
        "Street": null,
        "City": null,
        "State": null,
        "Location": null,
        "Precinct": null,
        "AreaPopulation": null,
        "MedianAge": null,
        "MedianHHoldIncome": null,
        "Grading": null,
        "BayCount": null,
        "TenancySqm": null,
        "RetailAreaSqm": null,
        "rid": "BFA1AM5ZblICAAAAAAAAAA=="
    },

The search being used is just *, e.g.

.../docs?api-version=2017-11-11&search=*

Upvotes: 0

Views: 194

Answers (1)

JamesMatson
JamesMatson

Reputation: 2922

This issue turned out to be the use of column names with spaces in them. These originally came from the Spreadsheet I was using to obtain the original data for CosmosDB. While CosmosDB will allow columns with spaces in the names, it will negatively affect (in my experience)

  • Azure Search
  • CosmosDb queries (found this out via testing the same data set with a Web App Bot).

Removing spaces from the column name and re-testing showed the issue to be resolved.

Upvotes: 0

Related Questions