I'm in the process to upgrade my old Elasticsearch cluster to Elasticsearch 5.0.
I noticed that they removed payload from Elasticsearch 5.0 and that's been preventing me from successfully upgrading Elasticsearch.
I realized that payload appears many times in my code. The following are my code snippets that include payload.
elasticClient.index({
index: "users",
type: "user",
id: username,
body: {
name_suggest: {
input: displayname
payload: { "user_id": username }
}
}
}, function(error) {
console.log(error);
});
I'm using React.js(JSX) and Express.js to show the search results in the following snippet.
return (
<ul id="searchValue" key="wow">
{result.options[0] ? <a href={"users/" + result.options[0].payload.user_id}><li style={{display: this.state.searchResults}} key={ result.options[0].payload.user_id }>{ result.options[0].text}</li></a> : null}
{result.options[1] ? <a href={"users/" + result.options[1].payload.user_id}><li style={{display: this.state.searchResults}} key={ result.options[1].payload.user_id }>{ result.options[1].text}</li></a> : null}
{result.options[2] ? <a href={"users/" + result.options[2].payload.user_id}><li style={{display: this.state.searchResults}} key={ result.options[2].payload.user_id}>{ result.options[2].text}</li></a> : null}
{result.options[3] ? <a href={"users/" + result.options[3].payload.user_id}><li style={{display: this.state.searchResults}} key={ result.options[3].payload.user_id}>{ result.options[3].text}</li></a> : null}
{result.options[4] ? <a href={"users/" + result.options[4].payload.user_id}><li style={{display: this.state.searchResults}} key={ result.options[4].payload.user_id}>{ result.options[4].text}</li></a> : null}
</ul>
)
As you can see, I use payload many times.
In Elasticsearch 5.0, how do I need to update the code to make it work without payload?