First, setup the parent/child relationship
curl -XDELETE "http://localhost:9200/test"
curl -XPOST "http://localhost:9200/test" -d'
{
"mappings": {
"child": {
curl -XPUT "http://localhost:9200/test " -d' | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"prefix": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ | |
"lowercase", |
curl -XPUT 'http://localhost:9200/us/user/1?pretty=1' -d ' | |
{ | |
"email" : "john@smith.com", | |
"name" : "John Smith", | |
"username" : "@john" | |
} | |
' | |
curl -XPUT 'http://localhost:9200/gb/user/2?pretty=1' -d ' | |
{ |
curl -XGET "http://localhost:9200/_search" -d' | |
{ | |
"query": { | |
"bool": { | |
"should": [ | |
{ | |
"match": { | |
"name": "foo" | |
} | |
}, |
POST /documents/_search | |
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"function_score": { | |
"query": { | |
"has_child": { | |
"type": "comment", |
POST /documents/_search | |
{ | |
"query": { | |
"bool": { | |
"must": { | |
"function_score": { | |
"query": { | |
"has_child": { | |
"type": "comment", |
First, setup the parent/child relationship
curl -XDELETE "http://localhost:9200/test"
curl -XPOST "http://localhost:9200/test" -d'
{
"mappings": {
"child": {
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d ' | |
{ | |
"mappings" : { | |
"test" : { | |
"properties" : { | |
"loc" : { | |
"type" : "geo_point" | |
} | |
} | |
} |
curl -XPUT 'http://127.0.0.1:9200/foo/?pretty=1' -d ' | |
{ | |
"mappings" : { | |
"bar" : { | |
"properties" : { | |
"text" : { | |
"index" : "not_analyzed", | |
"fielddata" : { | |
"filter" : { |
curl -XDELETE 'localhost:9200/test%2A?pretty=1' | |
curl -XPUT 'localhost:9200/test_1?pretty=1' -d ' | |
{ | |
"mappings" : { | |
"test" : { | |
"_parent" : { | |
"type" : "foo" | |
} | |
} |
# delete index if exists | |
curl -XDELETE localhost:9200/test/ | |
# create index with default settings | |
curl -XPOST localhost:9200/test/ | |
# create mapping | |
curl -XPUT localhost:9200/test/product/_mapping -d ' | |
{ | |
"product" : { |