# Autocomplete for attachment field

**URL:** <https://discuss.elastic.co/t/autocomplete-for-attachment-field/15968>\
**Category:** Elasticsearch\
**Created:** [February 22, 2014, 7:39pm UTC](https://discuss.elastic.co/t/autocomplete-for-attachment-field/15968 "2014-02-22T19:39:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jimmy\_Reeves](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jimmy\_Reeves](https://discuss.elastic.co/u/Jimmy_Reeves)\
**Post date:** [February 22, 2014, 7:39pm UTC](https://discuss.elastic.co/t/autocomplete-for-attachment-field/15968/1 "2014-02-22T19:39:59Z")

</div>

I am trying to set up autocompletion[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html) for  
the attachement field content and I am stuck.

Here is a mapping for my attachment that seems to work fine.  
{  
"attachment" : {  
"\_source" : {"excludes" : ["file"]},  
"\_all" : {"store" : "yes"},  
"properties" : {  
"file\_name" : {"type" : "string", "null\_value" : "N/A"},  
"file\_extension" : {"type" : "string", "null\_value" : "N/A"},  
"file" : {  
"type" : "attachment",  
"path": "full",  
"fields" : {  
"file" : {"type" : "string", "term\_vector" :  
"with\_positions\_offsets", "store" : "yes"},  
"title" : { "store" : "yes},  
"date" : {"store" : "yes"},  
"keywords" : {"store" : "yes"},  
"content\_type" : {"store" : "yes"},  
"content\_length" : {"store" : "yes"}  
}  
}  
}  
}  
}

So i tried to get autocompletion with adding  
"suggest" : {"type" : "completion", "index\_analyzer" : "simple",  
"search\_analyzer" : "simple"}  
field to "attachment" type and modifying inner "file" field like  
"file" : {"type" : "string", "term\_vector" : "with\_positions\_offsets",  
"store" : "yes", "copy\_to" : "suggest"}  
and the only thing i've got returned by autocomplete action are file  
extensions.

Then i tried multifield for inner "file" field  
"file" : {  
"type" : "multifield",  
"fields" : {  
"file" : {"type" : "string", "term\_vector" : "with\_positions\_offsets",  
"store" : "yes"},  
"suggest" : {"type" : "completion", "index\_analyzer" : "simple",  
"search\_analyzer" : "simple" }  
}  
}  
and i've got the same result for autocomplete action, but extracted text  
becames unavailbale while queying "file" field.

What am I doing wrong?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/59df56b3-793c-4139-8dc5-f2367d68aa7b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/59df56b3-793c-4139-8dc5-f2367d68aa7b%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jimmy\_Reeves](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jimmy\_Reeves](https://discuss.elastic.co/u/Jimmy_Reeves)\
**Post date:** [February 22, 2014, 11:22pm UTC](https://discuss.elastic.co/t/autocomplete-for-attachment-field/15968/2 "2014-02-22T23:22:42Z")

</div>

Ok, I've found one more problem here.  
Attachments are available for the search directly after getiing into the  
system. If I'll try to get "file" field like  
[http://localhost:9200/demo/attachment/1?fields=file&pretty=true](http://localhost:9200/demo/attachment/1?fields=file&pretty=true) directly  
after I'll get base64 encoded string.  
_BUT_ after a period of time the same request will return "file" field with  
extracted text.  
What is going on here?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/58712cd9-8f0f-4cdd-8de8-f73387b89e90%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/58712cd9-8f0f-4cdd-8de8-f73387b89e90%40googlegroups.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:** [February 23, 2014, 9:05am UTC](https://discuss.elastic.co/t/autocomplete-for-attachment-field/15968/3 "2014-02-23T09:05:55Z")

</div>

After 1s by default, your doc is stored in Lucene with all new fields generated by the mapper.  
Before that, when you get the file, it comes from the transaction log where it's stored as you send it.

My 2 cents.

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

Le 23 févr. 2014 à 00:22, Jimmy Reeves [6675636b6d65616c696365@gmail.com](mailto:6675636b6d65616c696365@gmail.com) a écrit :

## Ok, I've found one more problem here. Attachments are available for the search directly after getiing into the system. If I'll try to get "file" field like [http://localhost:9200/demo/attachment/1?fields=file&pretty=true](http://localhost:9200/demo/attachment/1?fields=file&pretty=true) directly after I'll get base64 encoded string. BUT after a period of time the same request will return "file" field with extracted text. What is going on here?

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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/58712cd9-8f0f-4cdd-8de8-f73387b89e90%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/58712cd9-8f0f-4cdd-8de8-f73387b89e90%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7FFF42A0-7833-49D2-9AC7-C72101ED7876%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/7FFF42A0-7833-49D2-9AC7-C72101ED7876%40pilato.fr).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jimmy\_Reeves](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jimmy\_Reeves](https://discuss.elastic.co/u/Jimmy_Reeves)\
**Post date:** [February 23, 2014, 12:51pm UTC](https://discuss.elastic.co/t/autocomplete-for-attachment-field/15968/4 "2014-02-23T12:51:56Z")

</div>

Thanks for response. May this cause a problem while proceeding data for  
alternative field?  
Also the attachment field itself can't be copied, this action could be  
performed only for it's inner fields. When I am trying to set this mapping  
option it just disappears.  
So the initial question about autocomplete is still relevant.

воскресенье, 23 февраля 2014 г., 9:05:55 UTC пользователь David Pilato  
написал:

> After 1s by default, your doc is stored in Lucene with all new fields  
> generated by the mapper.  
> Before that, when you get the file, it comes from the transaction log  
> where it's stored as you send it.
> 
> My 2 cents.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 23 févr. 2014 à 00:22, Jimmy Reeves \<[6675636b6d6...@gmail.com](mailto:6675636b6d6...@gmail.com)\<javascript:\>\>  
> a écrit :
> 
> Ok, I've found one more problem here.  
> Attachments are available for the search directly after getiing into the  
> system. If I'll try to get "file" field like  
> [http://localhost:9200/demo/attachment/1?fields=file&pretty=true](http://localhost:9200/demo/attachment/1?fields=file&pretty=true) directly  
> after I'll get base64 encoded string.  
> _BUT_ after a period of time the same request will return "file" field  
> with extracted text.  
> What is going on here?
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/58712cd9-8f0f-4cdd-8de8-f73387b89e90%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/58712cd9-8f0f-4cdd-8de8-f73387b89e90%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f146f1bb-390c-486d-960e-b7a5fc4f2703%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f146f1bb-390c-486d-960e-b7a5fc4f2703%40googlegroups.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, 1:48am UTC](https://discuss.elastic.co/t/autocomplete-for-attachment-field/15968/5 "2017-07-06T01:48:02Z")

</div>


