Hi,
I am trying to add a filter to a completion suggester. My case is a s
follows:
My index follows the user data flow pattern, but instead of users I have
accounts. Each account has its own alias and can consist of multiple number
of users that share the same document. Each document has an identification
field that correspond to the user who indexed that document.
What I want is to find a way that when a user enters some text in the
search box. The completion suggester will only return suggestions from
documents that have that user's ID.
Lets assume this example:
curl -XPUT "http://localhost:9200/account1/photos/_mapping" -d'
{
"photos": {
"properties": {
"userid": {
"type": "long"
},
"name": {
"type": "string"
},
"size": {
"type": "long"
},
"createDate": {
"type": "date",
"format": "dateOptionalTime"
},
"tags": {
"type": "string"
},
"suggest": {
"type": "completion",
"index_analyzer": "simple",
"search_analyzer": "simple",
"payloads": false
}
}
}
}'
Now lets assume user 1 has indexed a photo:
curl -XPUT "http://localhost:9200/account1/photos/1" -d'
{
"userid": 1,
"name": "somephoto.jpg",
"size": 10000,
"tags": [
"paris",
"noon"
],
"suggest": {
"input": [
"paris",
"noon"
]
},
"createDate": "2013-12-19"
}'
Now user 2 has also indexed a new photo:
curl -XPUT "http://localhost:9200/account1/photos/2" -d'
{
"userid": 2,
"name": "somephoto.jpg",
"size": 10000,
"tags": [
"london",
"night"
],
"suggest": {
"input": [
"london",
"night"
]
},
"createDate": "2013-12-19"
}'
Now what I want to do is when user 1 enters the text "lon" in the search
box, the suggester will return NO autocomplete suggestions. Yet when he
enters the test "par" the suggester will return "paris".
Is there anyway to do this?
--
Please update your bookmarks! We have moved to https://discuss.elastic.co/
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/93b62d01-60cd-4d7c-a68d-ed7edb987122%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.