# How to get around payload in Elasticsearch 5.0

**URL:** <https://discuss.elastic.co/t/how-to-get-around-payload-in-elasticsearch-5-0/73633>\
**Category:** Elasticsearch\
**Created:** [February 2, 2017, 6:13am UTC](https://discuss.elastic.co/t/how-to-get-around-payload-in-elasticsearch-5-0/73633 "2017-02-02T06:13:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumo7](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sumo7](https://discuss.elastic.co/u/sumo7)\
**Post date:** [February 2, 2017, 6:13am UTC](https://discuss.elastic.co/t/how-to-get-around-payload-in-elasticsearch-5-0/73633/1 "2017-02-02T06:13:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![sumo7](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sumo7](https://discuss.elastic.co/u/sumo7)\
**Post date:** [February 2, 2017, 11:17am UTC](https://discuss.elastic.co/t/how-to-get-around-payload-in-elasticsearch-5-0/73633/2 "2017-02-02T11:17:12Z")

</div>

I was able to solve this by myself.  
I posted a solution [here](http://stackoverflow.com/questions/41981011/how-to-get-around-payload-in-elasticsearch-5-0).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 2, 2017, 11:17am UTC](https://discuss.elastic.co/t/how-to-get-around-payload-in-elasticsearch-5-0/73633/3 "2017-03-02T11:17:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
