Hello team,
I'm facing a serious issue while trying to index a document.
I've simple java object "Country" which contains simple fields. Shown below;
@JsonProperty("country")
private String countryName;
@JsonProperty("states")
private List<State> states;
@JsonProperty("population")
private List<PopulationYearModel> population;
And State object as;
@JsonProperty("state")
private final String stateName;
@JsonProperty("population")
private final List<PopulationYearModel> population;
And last PopulationYearModel as;
private int year;
private long population;
This is a very simple object.
Now when i'm trying to index a country object; as below;
IndexRequest request = client.prepareIndex().setIndex(indexName).setType(mapping.getIndexType())
.setSource(datas, XContentType.JSON).request();
I'm getting an issues that ;
index {[world_population][population][null], source[n/a, actual length: [4.8kb], max length: 2kb ]}
How to fix this... ?
dadoonet
(David Pilato)
April 17, 2018, 11:18am
2
Can you show what is a JSON document generated by your code?
@dadoonet : I'm converting object to Bytes rather in String.
I'm not able to paste it over here due to limit of this box..
its nearly 8000 character.
dadoonet
(David Pilato)
April 17, 2018, 11:50am
5
Upload it to gist.github.com and paste the link here.
Please: here is the link: https://gist.github.com/nits2010/7b2a25e3c941f983d244703f16d7a1ae
Though if i use the same json using Kibana dev tools, with POST http method, this document got indexed.
But not from the java code mentioned above.
Problem Resolved.
It was due to bulk-processor. Since the setting of it are such that it never reaches to a threshold to execute the processor. Triggering the bulkprocessor.flush()
does the job.
But I still don't understand, why it doesn't happen automatically, once the whole stream is completed.
dadoonet
(David Pilato)
April 20, 2018, 2:14am
8
There was no mention of bulk in your initial question right?
system
(system)
Closed
May 18, 2018, 2:14am
9
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.