Creating type in ES

Hello ,
I am new to Elasticsearch. I have created index.
And Now adding type and document.
But getting error.
{"error":"no handler found for uri [/my_first_index/message] and method [POST]"}
Entering this command
curl -XPOST "http://localhost:9200/my_first_index/message" -d'{"text":"Hello World!"}'

Please share any configuration setting if needed.
Please help.

Thank you

Hi @smitak Welcome to the community.

First you should read this Removal of Types in detail.

Summary : there is no more setting the field _type to anything other than _doc if you want to indicate a type for a document then you would simply add your own type field


POST /my_first_index/_doc
  "type" : "message",
  "text": "Hello World!"

curl -XPOST "http://localhost:9200/my_first_index/_doc" -d'{"type":"message","text":"Hello World!"}'

Hello Sir,
Thanks a lot for reply.
I want to search keywords like php,java in pdf files(Files are stored in a folder.)
Can you please suggest what is the procedure.
I have created index and converted the pdf file to base64 format. But cant do search.
Please reply.

Can we index a pdf file or folder of files in ES and how?

You can have a look at FSCrawler project which does that.

Thank you Sir for reply.
Can you please share a link of any example.
And i am using elasticsearch-7.17.0 And integrating in Codeigniter Project.

Thank you so much sir. I will check and get back to you.

Hello Sir,
I have downloaded and now configured.
As per documentation i am changing the url in _setting.yml file
url :"D:\resumes" in which i have stored the sample resume pdf files for testing but it is giving error.
Please reply .

12:36:53,418 INFO [f.p.e.c.f.c.BootstrapChecks] Memory [Free/Total=Percent]: HEAP [99.2mb/1.9gb=5.0%], RAM [448.3mb/7.7gb=5.65%], Swap [4.6gb/19.2gb=24.08%].
12:36:53,588 INFO [f.p.e.c.f.FsCrawlerImpl] Starting FS crawler
12:36:53,588 INFO [f.p.e.c.f.FsCrawlerImpl] FS crawler started in watch mode. It will run unless you stop it with CTRL+C.
12:36:53,951 INFO [f.p.e.c.f.c.ElasticsearchClient] Elasticsearch Client connected to a node running version 7.17.0
12:36:53,968 INFO [f.p.e.c.f.c.ElasticsearchClient] Elasticsearch Client connected to a node running version 7.17.0
esumes] every [15m][f.p.e.c.f.FsParserAbstract] FS crawler started for [resumes] for [D:
esumes doesn't exists.p.e.c.f.FsParserAbstract] Error while crawling D:

Hello Sir,
I have changed D:\resumes to D:\\resumes and it works.My pdf files are indexed.
Thank you so much . I want to search in that files how to do that?
And one more help Now How to integrate in CI ?

Searching also done using the GET command.
Now I have ElasticSearch library in codeigniter and I have created sample index through that. But it was before FSCrawler . Now what i need to do for implement in CI. Please help.

I don't understand what do you mean by CI integration.

Finally I have done Sir. Thank you so much for your quick reply.
Its easy through FSCrawler.
Thank you so much.

Now I want to search in file contents only . Can you please tell me how to write query in kibana.

Something like that:

GET /indexname/_search
   "query": {
     "match": {
       "content": "text you are searching for"
1 Like

But if you are looking to a complete User Interface for end users, I'd recommend using Workplace Search (Workplace Search settings — FSCrawler 2.10-SNAPSHOT documentation). It comes with a full UI.

I did a demo of this recently at: Indexing your office documents with Elastic stack and FSCrawler

Yes sir I have done it.
Thanks a lot.

yes sir . I will look into it.
I want to add boolean query for search keywords now.

Thank you So much.

Hello sir ,
How i can fetch only file names from result array of search?

I want to say that i am integrating Elasticsearch in Codeigniter.
But Using the Elasticsearch Codeigniter library I have done it.