Reputation: 15058
I'm following the following tutorial about elasticsearch: https://www.elastic.co/blog/a-practical-introduction-to-elasticsearch
I imported shakespeare.json file to my elastic search. When I tried to run the following query:
POST localhost:9200/shakespeare/scene/_search/
{
"query":{
"match" : {
"play_name" : "Antony"
}
}
}
I got no results.
However, once I ran the same query without "/scene" I got many results. It looks that ElasticSearch fails to focus the search on specific type of data (in this case "scene").
Do you know what I can do about it?
Upvotes: 0
Views: 50
Reputation: 3667
TL;DR: The tutorial is outdated and the Shakespeare part is not working with recent versions of Elasticsearch anymore (at least inclomplete).
The shakesphere
is the index you want to search, and the /scene
part of the url is the document type you want to search. In past versions there was a option to store multiple document types in a single index but it has been removed in the recent versions.
While importing the json, just one type of documents has been imported/processed. And that's why you find sth. when you remove the type: elasticsearch is not limited to the scene
type anymore and yields results. In the response, there will be the type of each document (always the same), and if you look deeper on the data in the index, you'll notify that other document types don't exist.
Maybe the logs example or will suits you better. Oh, and if you install kibana, you'll be asked if you want to load some sample datasets like flight, ecommerce etc. The same data is also available at https://demo.elastic.co
Upvotes: 1