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 [email protected].
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.

Reply via email to