0

I am trying to add json documents to solr. I want the structure of the json file to be like:

{
    "add": {
        "doc": {
            "id": "DOC1",
            "my_boosted_field": {
                "boost": 2.3,
                "value": "test"
            }
        }
    },
    "add": {
        "commitWithin": 5000,
        "overwrite": false,
        "boost": 3.45,
        "doc": {
            "f1": "v1"
        }
    }
}

I cannot make it as an array as the Solr wants the exact same format to index the documents. How this can be done using gson or is there any other way?

annu
  • 75
  • 6

1 Answers1

0

Can you try modifying your JSON file like below.

{
    "add": {
        "doc": {
            "id": "DOC1",
            "my_boosted_field": {
                "boost": 2.3,
                "value": "test"
            },
            "f1": "v1"
        }
        "commitWithin": 5000,
        "overwrite": false,
        "boost": 3.45,    
    }
}
Ravi MCA
  • 2,491
  • 4
  • 20
  • 30