# Find matching word in text file using elk

**URL:** https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162
**Category:** Elasticsearch
**Created:** [April 30, 2019, 11:29pm UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162 "2019-04-30T23:29:26Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kumar4/32/48326_2.png) [@kumar4](https://discuss.elastic.co/u/kumar4)
#### Post date: [April 30, 2019, 11:29pm UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/1 "2019-04-30T23:29:26Z")

</div>

hi, can anyone help me, i want to find all sentneces containing a word in log or txt file using ELK, any examples plz

---

<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 1, 2019, 1:42am UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/2 "2019-05-01T01:42:05Z")

</div>

A match query would probably work. The documentation contains examples. Check it out.

---

<div class="post-metadata">

### Author: ![kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kumar4/32/48326_2.png) [@kumar4](https://discuss.elastic.co/u/kumar4)
#### Post date: [May 1, 2019, 8:45am UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/3 "2019-05-01T08:45:28Z")

</div>

thank you can you give me the link o the samle of filer and input, ouput in logstach and file beat

---

<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 1, 2019, 10:04am UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/4 "2019-05-01T10:04:02Z")

</div>

That's too vague. You probably need to understand first what filebeat is. Why do you think you need logstash ?

I recommend that you first read some blog post, watch some webinars and then you will have a better picture of what the stack is about.

But to sum up, I'd install

- filebeat (to collect logs)
- Elasticsearch (to index logs)
- Kibana (to use the Logs Application)

---

<div class="post-metadata">

### Author: ![kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kumar4/32/48326_2.png) [@kumar4](https://discuss.elastic.co/u/kumar4)
#### Post date: [May 2, 2019, 5:52pm UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/5 "2019-05-02T17:52:25Z")

</div>

no i am using fsrawler and i want to get the content and title of pdf that match a sentence ; what is the query to do that, i used a query but give gives me the content of all my pdfs files and this is not what i want

---

<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 2, 2019, 6:54pm UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/6 "2019-05-02T18:54:12Z")

</div>

That'd have been useful to give that information at the beginning to avoid a waste of time.

So FSCrawler indexed your documents, right?

You ran a query? Which one?

You said you're unhappy with the result but could you share what exactly you'd like to se vs the current result?

---

<div class="post-metadata">

### Author: ![kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kumar4/32/48326_2.png) [@kumar4](https://discuss.elastic.co/u/kumar4)
#### Post date: [May 2, 2019, 11:05pm UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/7 "2019-05-02T23:05:03Z")

</div>

this is th query:  
GET bigdata/\_search  
{  
"query" : {  
"match\_phrase": {  
"content" : "Un monde"  
}  
}  
}  
i want to seacrch all the pdf containing "the sentence Un monde" but it returns all fiiles; i want just the title of file containing this sentence

---

<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 3, 2019, 2:07am UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/8 "2019-05-03T02:07:57Z")

</div>

I'm surprised.  
Wondering how you are running the query, with which tool?

Any chance you are using Kibana dev console and that you added a blank line just after the `GET /_search` and the json body? Could you share a screenshot?

---

<div class="post-metadata">

### Author: ![kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kumar4/32/48326_2.png) [@kumar4](https://discuss.elastic.co/u/kumar4)
#### Post date: [May 3, 2019, 8:26am UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/9 "2019-05-03T08:26:20Z")

</div>

i am using kibana dev consol

---

<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 3, 2019, 9:25am UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/10 "2019-05-03T09:25:16Z")

</div>

Ok. And?

---

<div class="post-metadata">

### Author: ![kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kumar4/32/48326_2.png) [@kumar4](https://discuss.elastic.co/u/kumar4)
#### Post date: [May 6, 2019, 1:04am UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/11 "2019-05-06T01:04:54Z")

</div>

i want the query to retrive only document contaiing the matched sentence

---

<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 6, 2019, 5:14am UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/12 "2019-05-06T05:14:32Z")

</div>

I know that. You are just not answering my questions so I can't help further.

---

<div class="post-metadata">

### Author: ![kumar4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kumar4/32/48326_2.png) [@kumar4](https://discuss.elastic.co/u/kumar4)
#### Post date: [May 6, 2019, 2:00pm UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/13 "2019-05-06T14:00:29Z")

</div>

i have created index in fscrawler and i can do queries in kibana dev tools using "get index\_name" or get index\_name/\_search but what i want is to list the content of files and information about files containing a specific sentence or word that i mut specify, i want the query to do that

---

<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 6, 2019, 2:21pm UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/14 "2019-05-06T14:21:31Z")

</div>

Repeating my question:

> [@dadoonet](#):
>
> Could you share a screenshot?

---

<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: [June 3, 2019, 2:21pm UTC](https://discuss.elastic.co/t/find-matching-word-in-text-file-using-elk/179162/15 "2019-06-03T14:21:37Z")

</div>

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