Mapping for facets

Hi ,

I want to have my facets as a single word , so I am using keyword analyzer
as you see in destination_facets and facet_analyzer. But my facets comes as
white space tokenized. Below you can find my mapping configuration . Any
ideas?

{
"mappings": {
"hotel": {
'properties': {"name": {
"type": "string",
"search_analyzer": "str_search_analyzer",
"index_analyzer": "str_index_analyzer"},

            "destination": {'properties': {'en': {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},

            "country": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},
            "destination_facets": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "facet_analyzer"
            }}}

            }
        }
    },
    "settings": {
        "analysis": {
            "analyzer": {
                "str_search_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase"]
                },

                "str_index_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase", "substring"]
                },
                "facet_analyzer": {
                    "type": "keyword",
                    "tokenizer": "keyword"
                },
            },

            "filter": {
                "substring": {
                    "type": "edgeNGram",
                    "min_gram": 1,
                    "max_gram": 20,
                }
            }
        }
    }
}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

You set the search_analyzer on the field, and not the index_analyzer.
Simply use the analyzer attribute instead.

If you are not using the keyword analyzer in conjunction with a filter
(like your str_search_analyzer), I find it easier to simply mark the field
as not_analyzed.

--
Ivan

On Thu, May 30, 2013 at 7:52 AM, TunaVargı tuna40@gmail.com wrote:

Hi ,

I want to have my facets as a single word , so I am using keyword analyzer
as you see in destination_facets and facet_analyzer. But my facets comes as
white space tokenized. Below you can find my mapping configuration . Any
ideas?

{
"mappings": {
"hotel": {
'properties': {"name": {
"type": "string",
"search_analyzer": "str_search_analyzer",
"index_analyzer": "str_index_analyzer"},

            "destination": {'properties': {'en': {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},

            "country": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},
            "destination_facets": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "facet_analyzer"
            }}}

            }
        }
    },
    "settings": {
        "analysis": {
            "analyzer": {
                "str_search_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase"]
                },

                "str_index_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase", "substring"]
                },
                "facet_analyzer": {
                    "type": "keyword",
                    "tokenizer": "keyword"
                },
            },

            "filter": {
                "substring": {
                    "type": "edgeNGram",
                    "min_gram": 1,
                    "max_gram": 20,
                }
            }
        }
    }
}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

How can I set the field as not analyzed. I am using pyelasticsearch package
for indexing. Is there a way to do that during mapping

30 Mayıs 2013 Perşembe 18:06:41 UTC+3 tarihinde Ivan Brusic yazdı:

You set the search_analyzer on the field, and not the index_analyzer.
Simply use the analyzer attribute instead.

If you are not using the keyword analyzer in conjunction with a filter
(like your str_search_analyzer), I find it easier to simply mark the field
as not_analyzed.

--
Ivan

On Thu, May 30, 2013 at 7:52 AM, TunaVargı <tun...@gmail.com <javascript:>

wrote:

Hi ,

I want to have my facets as a single word , so I am using keyword
analyzer as you see in destination_facets and facet_analyzer. But my facets
comes as white space tokenized. Below you can find my mapping configuration
. Any ideas?

{
"mappings": {
"hotel": {
'properties': {"name": {
"type": "string",
"search_analyzer": "str_search_analyzer",
"index_analyzer": "str_index_analyzer"},

            "destination": {'properties': {'en': {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},

            "country": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},
            "destination_facets": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "facet_analyzer"
            }}}

            }
        }
    },
    "settings": {
        "analysis": {
            "analyzer": {
                "str_search_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase"]
                },

                "str_index_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase", "substring"]
                },
                "facet_analyzer": {
                    "type": "keyword",
                    "tokenizer": "keyword"
                },
            },

            "filter": {
                "substring": {
                    "type": "edgeNGram",
                    "min_gram": 1,
                    "max_gram": 20,
                }
            }
        }
    }
}

--
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 elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

not_analyzed is an index setting:
"en" : {"type" : "string", "index" : "not_analyzed"}

The effect is similar to having a keyword analyzer, but I prefer to think
of such fields as not_analyzed.

--
Ivan

On Thu, May 30, 2013 at 11:21 PM, TunaVargı tuna40@gmail.com wrote:

How can I set the field as not analyzed. I am using pyelasticsearch
package for indexing. Is there a way to do that during mapping

30 Mayıs 2013 Perşembe 18:06:41 UTC+3 tarihinde Ivan Brusic yazdı:

You set the search_analyzer on the field, and not the index_analyzer.
Simply use the analyzer attribute instead.

If you are not using the keyword analyzer in conjunction with a filter
(like your str_search_analyzer), I find it easier to simply mark the field
as not_analyzed.

--
Ivan

On Thu, May 30, 2013 at 7:52 AM, TunaVargı tun...@gmail.com wrote:

Hi ,

I want to have my facets as a single word , so I am using keyword
analyzer as you see in destination_facets and facet_analyzer. But my facets
comes as white space tokenized. Below you can find my mapping configuration
. Any ideas?

{
"mappings": {
"hotel": {
'properties': {"name": {
"type": "string",
"search_analyzer": "str_search_analyzer",
"index_analyzer": "str_index_analyzer"},

            "destination": {'properties': {'en': {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},

            "country": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},
            "destination_facets": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "facet_analyzer"
            }}}

            }
        }
    },
    "settings": {
        "analysis": {
            "analyzer": {
                "str_search_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase"]
                },

                "str_index_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase", "substring"]
                },
                "facet_analyzer": {
                    "type": "keyword",
                    "tokenizer": "keyword"
                },
            },

            "filter": {
                "substring": {
                    "type": "edgeNGram",
                    "min_gram": 1,
                    "max_gram": 20,
                }
            }
        }
    }
}

--
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 elasticsearc...@**googlegroups.com.

For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks for the response, I tried it like this but my destination facets
comes as whitespace tokenized. Altough I said not analyzed for it. Any
ideas?
{
"mappings": {
"hotel": {
'properties': {"name": {
"type": "string",
"analyzer": "str_index_analyzer"},

            "destination": {'properties': {'en': {
                "type": "string",
                "analyzer": "str_index_analyzer"}}},

            "country": {"properties": {"en": {
                "type": "string",
                "analyzer": "str_index_analyzer"}}},
            "destination_facets": {"properties": {"en": {
                "type": "string",
                "index": "not_analyzed"
            }}}

            }
        }
    },
    "settings": {
        "analysis": {
            "analyzer": {
                "str_index_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase", "substring", "whitespace"]
                }
            },
            "filter": {
                "substring": {
                    "type": "edgeNGram",
                    "min_gram": 1,
                    "max_gram": 20,
                }
            }
        }
    }
}

30 Mayıs 2013 Perşembe 17:52:54 UTC+3 tarihinde TunaVargı yazdı:

Hi ,

I want to have my facets as a single word , so I am using keyword analyzer
as you see in destination_facets and facet_analyzer. But my facets comes as
white space tokenized. Below you can find my mapping configuration . Any
ideas?

{
"mappings": {
"hotel": {
'properties': {"name": {
"type": "string",
"search_analyzer": "str_search_analyzer",
"index_analyzer": "str_index_analyzer"},

            "destination": {'properties': {'en': {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},

            "country": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "str_search_analyzer",
                "index_analyzer": "str_index_analyzer"}}},
            "destination_facets": {"properties": {"en": {
                "type": "string",
                "search_analyzer": "facet_analyzer"
            }}}

            }
        }
    },
    "settings": {
        "analysis": {
            "analyzer": {
                "str_search_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase"]
                },

                "str_index_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase", "substring"]
                },
                "facet_analyzer": {
                    "type": "keyword",
                    "tokenizer": "keyword"
                },
            },

            "filter": {
                "substring": {
                    "type": "edgeNGram",
                    "min_gram": 1,
                    "max_gram": 20,
                }
            }
        }
    }
}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.