# Can't index TXT file and search text

**URL:** https://discuss.elastic.co/t/cant-index-txt-file-and-search-text/11817
**Category:** Elasticsearch
**Created:** [May 5, 2013, 4:28am UTC](https://discuss.elastic.co/t/cant-index-txt-file-and-search-text/11817 "2013-05-05T04:28:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![David\_Barbe](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@David\_Barbe](https://discuss.elastic.co/u/David_Barbe)
#### Post date: [May 5, 2013, 4:28am UTC](https://discuss.elastic.co/t/cant-index-txt-file-and-search-text/11817/1 "2013-05-05T04:28:47Z")

</div>

Hi,

I have Server with 280 Tera of logs  
I want to index the _.txt ,_.DB ,\*.pcap or \*.log file.

1. I try to index the txt file after download plugin mapper-documment with  
this command:

- curl -XPUT '[http://localhost:9200/test/diag\_auto/1](http://localhost:9200/test/diag_auto/1)' -d '{ "user" :  
"diag\_auto", "post\_date" : "2013-5-5", "my\_attachment" : { "\_attachement" :  
"/extra/log/level.txt" } }  
this is not work ☹

1. After I want to do simply and advanced search:

a) Search word or line in the log  
I want to receive back in wiche file is displayed and also the line in the  
file.

b) Search series of word example: i have this,

Line 0 = B  
Line 1 = A  
Line 2 = S  
Line 3 = C  
Line 4 = B  
Line 5 = C  
I send command to search the first A and only after B and C so i will have  
back this : Line 1 = A, Line 4 = B, Line 5 = C

Thanks and Best regards  
Barbe David

--  
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: [May 5, 2013, 8:19am UTC](https://discuss.elastic.co/t/cant-index-txt-file-and-search-text/11817/2 "2013-05-05T08:19:54Z")

</div>

Hi David,

1. to use attachment plugin, you have to define a mapping first. Then encode your file in Base64, then send it to ES. Read [https://github.com/elasticsearch/elasticsearch-mapper-attachments](https://github.com/elasticsearch/elasticsearch-mapper-attachments)  
Look at the FSriver code source if you need an example. [https://github.com/dadoonet/fsriver](https://github.com/dadoonet/fsriver)

2. 

a) ok.  
b) with attachment plugin, everything will be flatten. So your lines will be indexed as "B A S C B C". Note that A is a stop word and won't be indexed.

BTW, have a look at logstash and Kibana project. It should help you here.

## HTH

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

Le 5 mai 2013 à 06:28, David Barbe [david@famillebarbe.com](mailto:david@famillebarbe.com) a écrit :

Hi,

I have Server with 280 Tera of logs  
I want to index the _.txt ,_.DB ,\*.pcap or \*.log file.

1. I try to index the txt file after download plugin mapper-documment with this command:

- curl -XPUT '[http://localhost:9200/test/diag\_auto/1](http://localhost:9200/test/diag_auto/1)' -d '{ "user" : "diag\_auto", "post\_date" : "2013-5-5", "my\_attachment" : { "\_attachement" : "/extra/log/level.txt" } }  
this is not work ☹

1. After I want to do simply and advanced search:

Thanks and Best regards  
Barbe David

--  
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:38am UTC](https://discuss.elastic.co/t/cant-index-txt-file-and-search-text/11817/3 "2017-07-06T02:38:15Z")

</div>


