Created
April 17, 2017 04:52
-
-
Save masaruh/f217c26cf9b52ca71381b088f0e78630 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
################################ | |
## THIS WORKS AS EXPECTED | |
################################ | |
DELETE place | |
### create cat field as text type | |
PUT place | |
{ | |
"mappings": { | |
"shops": { | |
"properties": { | |
"suggest": { | |
"type": "completion", | |
"contexts": [ | |
{ | |
"name": "place_type", | |
"type": "category", | |
"path": "cat" | |
} | |
] | |
}, | |
"cat":{ | |
"type": "text" | |
} | |
} | |
} | |
} | |
} | |
PUT place/shops/1 | |
{ | |
"suggest": ["timmy's", "starbucks", "dunkin donuts"], | |
"cat": ["cafe", "food"] | |
} | |
## This returns contexts "cafe" and "food" as expected | |
GET place/_search | |
{ | |
"suggest": { | |
"place_suggestion": { | |
"prefix": "tim", | |
"completion": { | |
"field": "suggest", | |
"contexts": { | |
} | |
} | |
} | |
} | |
} | |
################################ | |
## THIS DOESN'T WORK | |
################################ | |
DELETE place | |
### create cat field as text type | |
PUT place | |
{ | |
"mappings": { | |
"shops": { | |
"properties": { | |
"suggest": { | |
"type": "completion", | |
"contexts": [ | |
{ | |
"name": "place_type", | |
"type": "category", | |
"path": "cat" | |
} | |
] | |
}, | |
"cat":{ | |
"type": "keyword" | |
} | |
} | |
} | |
} | |
} | |
PUT place/shops/1 | |
{ | |
"suggest": ["timmy's", "starbucks", "dunkin donuts"], | |
"cat": ["cafe", "food"] | |
} | |
## This returns contexsts as null | |
GET place/_search | |
{ | |
"suggest": { | |
"place_suggestion": { | |
"prefix": "tim", | |
"completion": { | |
"field": "suggest", | |
"contexts": { | |
} | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment