Created
January 11, 2017 08:30
-
-
Save un1t/47506a95a26227a01d2c5d6e063790f3 to your computer and use it in GitHub Desktop.
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
curl -XPUT 'http://localhost:9200/_bulk?pretty' -d ' | |
{ "index" : { "_index" : "test", "_type" : "publication", "_id" : "1" } } | |
{ "title" : "The NoSQL database glut", "journal" : "2", "author": [{"title": "August S"}, {"title": "Weiss P L"}] } | |
{ "index" : { "_index" : "test", "_type" : "publication", "_id" : "2" } } | |
{ "title" : "Graph Databases Seen Connecting the Dots", "journal" : "1", "author": [{"title": "Weiss S"}] } | |
' | |
curl -XGET 'http://localhost:9200/test/_search?pretty' -d '{"query": {"match": {"author.title": {"query": "weiss s", "operator": "and"}}}}' | |
curl -XGET 'http://localhost:9200/test/_mapping?pretty' | |
{ | |
"test" : { | |
"mappings" : { | |
"publication" : { | |
"properties" : { | |
"author" : { | |
"properties" : { | |
"title" : { | |
"type" : "string" | |
} | |
} | |
}, | |
"journal" : { | |
"type" : "string" | |
}, | |
"title" : { | |
"type" : "string" | |
} | |
} | |
} | |
} | |
} | |
} | |
curl -XDELETE http://localhost:9200/test | |
curl -XPUT 'http://localhost:9200/test/' -d ' | |
{ | |
"mappings" : { | |
"publication" : { | |
"properties" : { | |
"author" : { | |
"type": "nested", | |
"properties" : { | |
"title" : { | |
"type" : "string" | |
} | |
} | |
}, | |
"journal" : { | |
"type" : "string" | |
}, | |
"title" : { | |
"type" : "string" | |
} | |
} | |
} | |
} | |
} | |
' | |
curl -XGET 'http://localhost:9200/test/_mapping?pretty' | |
curl -XGET 'http://localhost:9200/test/_search?pretty' -d ' | |
{ | |
"query": { | |
"nested": { | |
"path": "author", | |
"query": { | |
"match": { | |
"author.title": { | |
"query": "weiss s", "operator": "and" | |
} | |
} | |
} | |
} | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment