Version: 2.5
I am using Elasticsearch 7.4 and java client api. I want to use context suggester with search api given in this document Suggesters | Elasticsearch Guide [8.6] | Elastic can any one give me any sample documents which explains how to do in java api service
I am querying like this and my mapping is
POST ***_autosuggest/_search?pretty
{
"suggest": {
"place_suggestion": {
"prefix": "tim",
"completion": {
"field": "suggest",
"size": 10,
"contexts": {
"genre": [ "**-faculty", "**-companies" ]
}
}
}
}
}
{
"**_autosuggest": {
"aliases": {},
"mappings": {
"properties": {
"dictionary": {
"type": "keyword",
"index": false,
"store": true
},
"suggest": {
"type": "completion",
"analyzer": "suggestionAnalyzer",
"preserve_separators": true,
"preserve_position_increments": false,
"max_input_length": 50,
"contexts": [
{
"name": "genre",
"type": "CATEGORY"
}
]
},
"suggestion": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"title": {
"type": "keyword",
"index": false,
"store": true
}
}
},
"settings": {
"index": {
"number_of_shards": "1",
"provided_name": "***_autosuggest",
"creation_date": "1679448840300",
"analysis": {
"filter": {
"en_stop": {
"type": "stop",
"stopwords": [
"_english_"
]
}
},
"analyzer": {
"suggestionAnalyzer": {
"filter": [
"lowercase",
"en_stop"
],
"type": "custom",
"tokenizer": "standard"
}
}
},
"number_of_replicas": "0",
"uuid": "t97z4ZYdRB2KclQV28fTTQ",
"version": {
"created": "136277827"
}
}
}
}
}
I am using Elasticsearch 7.4 and java client api. I want to use context suggester with search api given in this document Suggesters | Elasticsearch Guide [8.6] | Elastic can any one give me any sample documents which explains how to do in java api service
I am trying to create Java API service which will give me results as like following opensearch query.
POST ***_autosuggest/_search?pretty
{
"suggest": {
"place_suggestion": {
"prefix": "tim",
"completion": {
"field": "suggest",
"size": 10,
"contexts": {
"genre": [ "**-faculty", "**-companies" ]
}
}
}
}
}