Bug in context suggester?


(Gchang10) #1

I am observing an issue with field reference in context suggester. Consider
the following use case:

PUT /services/service/_mapping
{
"service": {
"properties": {
"name": {
"type" : "string"
},
"network_id": {
"type" : "long"
},
"suggest_field": {
"type": "completion",
"context": {
"network": {
"type": "category",
"path": "network_id"
}
}
}
}
}
}

PUT /services/service/1
{
"name": "knapsack",
"network_id": 1,
"suggest_field": {
"input": ["knacksack", "backpack", "daypack"]
}
}

POST services/_suggest?pretty'
{
"suggest" : {
"text" : "k",
"completion" : {
"field" : "suggest_field",
"size": 10,
"context": {
"network": 1
}
}
}
}

The suggest query does not return any option. However, if I change the
field type of network_id to 'string' (and not_analyzed), the suggest query
works. Explicitly indexing the network_id as the context in the
suggest_field works as well:

PUT /services/service/1
{
"name": "knapsack",
"network_id": 1,
"suggest_field": {
"input": ["knacksack", "backpack", "daypack"],
"context": {"network_id": 1}
}
}

Seems like a bug?

--
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/214f059d-e2e6-4a28-aaaf-7dc6c1e1bcad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Alexander Reelsen) #2

Hey,

the problem is, that the mapping of the context variable 'network_id' is
not a string. Thinking if we either should support this or reject it
directly and only support string fields in the suggester.

Added github issue

--Alex

On Fri, Jun 6, 2014 at 8:41 PM, Gilbert Chang gilbertchang10@gmail.com
wrote:

I am observing an issue with field reference in context suggester.
Consider the following use case:

PUT /services/service/_mapping
{
"service": {
"properties": {
"name": {
"type" : "string"
},
"network_id": {
"type" : "long"
},
"suggest_field": {
"type": "completion",
"context": {
"network": {
"type": "category",
"path": "network_id"
}
}
}
}
}
}

PUT /services/service/1
{
"name": "knapsack",
"network_id": 1,
"suggest_field": {
"input": ["knacksack", "backpack", "daypack"]
}
}

POST services/_suggest?pretty'
{
"suggest" : {
"text" : "k",
"completion" : {
"field" : "suggest_field",
"size": 10,
"context": {
"network": 1
}
}
}
}

The suggest query does not return any option. However, if I change the
field type of network_id to 'string' (and not_analyzed), the suggest query
works. Explicitly indexing the network_id as the context in the
suggest_field works as well:

PUT /services/service/1
{
"name": "knapsack",
"network_id": 1,
"suggest_field": {
"input": ["knacksack", "backpack", "daypack"],
"context": {"network_id": 1}
}
}

Seems like a bug?

--
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/214f059d-e2e6-4a28-aaaf-7dc6c1e1bcad%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/214f059d-e2e6-4a28-aaaf-7dc6c1e1bcad%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAGCwEM-oAgFRo8sRkNCD2X4jo6ZUdevPHmyHS1nzd7JTeK0mgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3