Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P5975
(An Untitled Masterwork)
Active
Public
Actions
Authored by
EBernhardson
on Sep 8 2017, 1:01 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F9385634:
Sep 8 2017, 1:02 AM
2017-09-08 01:02:51 (UTC+0)
F9385540:
Sep 8 2017, 1:01 AM
2017-09-08 01:01:21 (UTC+0)
Subscribers
None
#!/bin/sh
curl -XDELETE localhost:9200/wikidata
|
jq .
curl -XPUT localhost:9200/wikidata -d
'{
"settings": {
"analysis": {
"analyzer": {
"keyword_before_colon": {
"tokenizer": "colon_tokenizer",
"filter": ["single_token_limit"]
}
},
"tokenizer": {
"colon_tokenizer": {
"type": "pattern",
"pattern": ":"
}
},
"filter": {
"single_token_limit": {
"type": "limit",
"max_token_count": 1
}
}
}
},
"mappings": {
"page": {
"properties": {
"relationships": {
"type": "keyword",
"fields": {
"properties": {
"type": "text",
"analyzer": "keyword_before_colon",
"search_analyzer": "keyword"
}
}
}
}
}
}
}'
|
jq .
curl -XPUT localhost:9200/wikidata/page/1 -d
'{"relationships": ["P31:Q54321", "P1:Q1234", "P31:Q7654"]}'
|
jq .
curl -XGET localhost:9200/wikidata/page/1/_termvectors -d
'{"fields": ["relationships", "relationships.properties"]}'
|
jq
'.term_vectors | with_entries({key: .key, value: .value.terms | to_entries | map(.key)})'
Event Timeline
EBernhardson
created this paste.
Sep 8 2017, 1:01 AM
2017-09-08 01:01:21 (UTC+0)
EBernhardson
edited the content of this paste.
(Show Details)
Log In to Comment