Gerke
Gerke

Reputation: 976

Solr stores indexed Documents values in array

I am indexing multiple documents to Solr cloud with on query via API and json like this:

[
  {
    "id": "1",
    "title": "Doc 1",
    "author": "exmaple"
  },
  {
    "id": "2",
    "title": "Doc 2",
    "author": "exmaple"
  }
]

The documents are indexed, including all values, but some values are stored in an array in solr:

"response":{"numFound":2,"start":0,"maxScore":1.0,"docs":[
      {
        "id":"1",
        "title":["Doc 1"],
        "author":"exmaple",
        "author_s":"exmaple",
        "_version_":1631766743831543808},
      {
        "id":"2",
        "title":["Doc 2"],
        "author":"exmaple",
        "author_s":"exmaple",
        "_version_":1631766743831543808}]
  }

Does anyone have an idea why in this case title is stored in an array?

Upvotes: 1

Views: 554

Answers (1)

Abhijit Bashetti
Abhijit Bashetti

Reputation: 8668

You must have added the attribute as multivalued = true for the field Title.

This attribute is useful when there are more than one value present for particular field. If don't want to store the field in multivalue form, remove the attribute for the same field.

Remove the same and restart the server.

Re-index the data.

Upvotes: 3

Related Questions