# Questions on completion suggestor

**URL:** <https://discuss.elastic.co/t/questions-on-completion-suggestor/14210>\
**Category:** Elasticsearch\
**Created:** [November 1, 2013, 2:27am UTC](https://discuss.elastic.co/t/questions-on-completion-suggestor/14210 "2013-11-01T02:27:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [November 1, 2013, 2:27am UTC](https://discuss.elastic.co/t/questions-on-completion-suggestor/14210/1 "2013-11-01T02:27:47Z")

</div>

Hi all - I have been trying to save documents in elastic search and one of  
the fields in my schema is of type "completion."  
In this article [http://www.elasticsearch.org/blog/you-complete-me/](http://www.elasticsearch.org/blog/you-complete-me/), I see  
the json request to save the document. I am using Java client and I am  
unable to find a right Java API which I can use to save the data for the  
"completion" type field. Can you pl point me to the right java API?

Just to summary, pl let me know the java counter part for how I can index  
the part below in blue.

curl -X PUT localhost:9200/hotels/hotel/3 -d '  
{  
"name" : "Courtyard by Marriot Munich City",

"city" : "Munich",  
"name\_suggest" : {

```
"input" : [
  "Courtyard by Marriot Munich City",

  "Marriot Munich City"
],
"output": "Hotel Marriot",

"weight": 15,
"payload": { "hotel_id": 3}

```

}  
}'

-Amit.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 1, 2013, 3:11am UTC](https://discuss.elastic.co/t/questions-on-completion-suggestor/14210/2 "2013-11-01T03:11:38Z")

</div>

It's the same API you use to index regular documents.

How do you build your docs in Java?  
Jackson? XContent helpers? String concatenation?

HTH

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 1 nov. 2013 à 02:27, Amit Soni [amitsoni29@gmail.com](mailto:amitsoni29@gmail.com) a écrit :

> Hi all - I have been trying to save documents in Elasticsearch and one of the fields in my schema is of type "completion."  
> In this article, I see the json request to save the document. I am using Java client and I am unable to find a right Java API which I can use to save the data for the "completion" type field. Can you pl point me to the right java API?
> 
> Just to summary, pl let me know the java counter part for how I can index the part below in blue.  
> curl -X PUT localhost:9200/hotels/hotel/3 -d '
> 
> {  
> "name" : "Courtyard by Marriot Munich City",
> 
> "city" : "Munich",  
> "name\_suggest" : {
> 
> ```
> "input" : [
> "Courtyard by Marriot Munich City",
> 
> "Marriot Munich City"
> ],
> "output": "Hotel Marriot",
> 
> "weight": 15,
> "payload": { "hotel_id": 3}
> 
> ```
> 
> }  
> }'
> 
> ## -Amit.
> 
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [November 1, 2013, 4:31am UTC](https://discuss.elastic.co/t/questions-on-completion-suggestor/14210/3 "2013-11-01T04:31:58Z")

</div>

Hi David - I have been using jackson. Okay, so I can create some more POJOs  
(which conform to the above json for storing this special field) and then  
use them to save the document via jackson. Right?

-Amit.

On Thu, Oct 31, 2013 at 8:11 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> It's the same API you use to index regular documents.
> 
> How do you build your docs in Java?  
> Jackson? XContent helpers? String concatenation?
> 
> HTH
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 1 nov. 2013 à 02:27, Amit Soni [amitsoni29@gmail.com](mailto:amitsoni29@gmail.com) a écrit :
> 
> Hi all - I have been trying to save documents in Elasticsearch and one of  
> the fields in my schema is of type "completion."  
> In this article [http://www.elasticsearch.org/blog/you-complete-me/](http://www.elasticsearch.org/blog/you-complete-me/), I  
> see the json request to save the document. I am using Java client and I am  
> unable to find a right Java API which I can use to save the data for the  
> "completion" type field. Can you pl point me to the right java API?
> 
> Just to summary, pl let me know the java counter part for how I can index  
> the part below in blue.
> 
> curl -X PUT localhost:9200/hotels/hotel/3 -d '
> 
> {  
> "name" : "Courtyard by Marriot Munich City",
> 
> "city" : "Munich",  
> "name\_suggest" : {
> 
> ```
> "input" : [
> "Courtyard by Marriot Munich City",
> 
> "Marriot Munich City"
> ],
> "output": "Hotel Marriot",
> 
> "weight": 15,
> "payload": { "hotel_id": 3}
> 
> ```
> 
> }  
> }'
> 
> -Amit.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 1, 2013, 6:54am UTC](https://discuss.elastic.co/t/questions-on-completion-suggestor/14210/4 "2013-11-01T06:54:39Z")

</div>

Yeah. I guess so.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 1 nov. 2013 à 04:31, Amit Soni [amitsoni29@gmail.com](mailto:amitsoni29@gmail.com) a écrit :

> Hi David - I have been using jackson. Okay, so I can create some more POJOs (which conform to the above json for storing this special field) and then use them to save the document via jackson. Right?
> 
> -Amit.
> 
> On Thu, Oct 31, 2013 at 8:11 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > It's the same API you use to index regular documents.
> > 
> > How do you build your docs in Java?  
> > Jackson? XContent helpers? String concatenation?
> > 
> > HTH
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 1 nov. 2013 à 02:27, Amit Soni [amitsoni29@gmail.com](mailto:amitsoni29@gmail.com) a écrit :
> > 
> > > Hi all - I have been trying to save documents in Elasticsearch and one of the fields in my schema is of type "completion."  
> > > In this article, I see the json request to save the document. I am using Java client and I am unable to find a right Java API which I can use to save the data for the "completion" type field. Can you pl point me to the right java API?
> > > 
> > > Just to summary, pl let me know the java counter part for how I can index the part below in blue.  
> > > curl -X PUT localhost:9200/hotels/hotel/3 -d '
> > > 
> > > {  
> > > "name" : "Courtyard by Marriot Munich City",
> > > 
> > > "city" : "Munich",  
> > > "name\_suggest" : {
> > > 
> > > ```
> > > "input" : [
> > > "Courtyard by Marriot Munich City",
> > > 
> > > "Marriot Munich City"
> > > ],
> > > "output": "Hotel Marriot",
> > > 
> > > "weight": 15,
> > > "payload": { "hotel_id": 3}
> > > 
> > > ```
> > > 
> > > }  
> > > }'
> > > 
> > > ## -Amit.
> > > 
> > > You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:09am UTC](https://discuss.elastic.co/t/questions-on-completion-suggestor/14210/5 "2017-07-06T02:09:23Z")

</div>


