- Elasticsearch 7.0 Cookbook(Fourth Edition)
- Alberto Paro
- 159字
- 2021-06-24 14:52:33
Getting ready
You need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 1, Getting Started.
To execute these commands any, HTTP client can be used such, as curl (https://curl.haxx.se/), postman (https://www.getpostman.com/), or something similar. I suggest using the Kibana console as it provides code completion and better character escaping for Elasticsearch.
To correctly execute the following commands, you will need an index populated with the ch04/populate_kibana.txt commands, which is available in the online code.
The mapping that's used in all the queries in this chapter and searches is similar to the following book representation:
The command to create the schema is as follows:
PUT /mybooks
{
"mappings": {
"properties": {
"join_field": {
"type": "join",
"relations": {
"order": "item"
...
...
"title": {
"term_vector": "with_positions_offsets",
"store": true,
"type": "text",
"fielddata": true,
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}