This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################### | |
################################################### | |
# Elasticsearch Lessons Learned | |
################################################### | |
################################################### | |
# Delete the "books" index, just in case it is still there from previous experiments. | |
DELETE /books |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete the index, just in case it still exists. | |
DELETE /myindex | |
# Create the index with a mapping declaring a nested field. | |
PUT /myindex | |
{ | |
"mappings": { | |
"document": { | |
"properties": { | |
"common_id": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Transactions with parent-child relationships using counters. | |
# Delete the index, just in case it still exists. | |
DELETE /myindex | |
# Create the index with a mapping for the actual documents and a mapping for the parent transaction type. | |
PUT /myindex | |
{ | |
"mappings": { | |
"transaction": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Transactions with parent-child relationships. | |
# Delete the index, just in case it still exists. | |
DELETE /myindex | |
# Create the index with a mapping for the actual documents and a mapping for the parent transaction type. | |
PUT /myindex | |
{ | |
"mappings": { | |
"transaction": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################### | |
################################################### | |
# Crash course | |
################################################### | |
################################################### | |
En | |
################################################### | |
# Quickstart | |
################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package peschlowp.test.elasticsearch; | |
import java.io.IOException; | |
import java.util.Date; | |
import java.util.Map; | |
import java.util.Random; | |
import org.elasticsearch.action.search.SearchResponse; | |
import org.elasticsearch.client.Client; | |
import org.elasticsearch.common.settings.ImmutableSettings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ppe.test.elasticsearch; | |
import java.io.IOException; | |
import org.elasticsearch.action.ActionFuture; | |
import org.elasticsearch.client.Client; | |
import org.elasticsearch.common.xcontent.XContentBuilder; | |
import org.elasticsearch.common.xcontent.XContentFactory; | |
import org.elasticsearch.node.Node; | |
import org.elasticsearch.node.NodeBuilder; |