# Analyzing a list without analyzing the values in the list (for facetting)

**URL:** <https://discuss.elastic.co/t/analyzing-a-list-without-analyzing-the-values-in-the-list-for-facetting/14055>\
**Category:** Elasticsearch\
**Created:** [October 22, 2013, 11:39am UTC](https://discuss.elastic.co/t/analyzing-a-list-without-analyzing-the-values-in-the-list-for-facetting/14055 "2013-10-22T11:39:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Orr](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Simon\_Orr](https://discuss.elastic.co/u/Simon_Orr)\
**Post date:** [October 22, 2013, 11:39am UTC](https://discuss.elastic.co/t/analyzing-a-list-without-analyzing-the-values-in-the-list-for-facetting/14055/1 "2013-10-22T11:39:22Z")

</div>

I've got a Tags field in my index defined as ....

"Tags" : {  
"type" : "multi\_field",  
"fields" : {  
"Tags" : {  
"type" : "string"  
},  
"Raw" : {  
"type" : "string",  
"index" : "not\_analyzed",  
"omit\_norms" : true,  
"index\_options" : "docs",  
"include\_in\_all" : false  
}  
}  
},

I'm using this field to store a list of tags. 3 sample documents:

{"Tags": ["SomeTag", "SomeOtherTag", "Some.Tag3"]},  
{"Tags": ["SomeTag", "Some.Tag3"]},  
{"Tags": ["SomeTag"]}

This works fine for storing, retrieving and searching.

The problem occurs when I want to retrieve a full list of all tags in the  
system (and a count of their usage).

My initial approach was to facet on the Tags field. If I facet on Tags directly  
(effectively, the Analysed field), I get...

"sometag": 3,  
"someothertag": 1,  
"some": 2,  
"tag3": 2

Note that Some.Tag3 has been split by the tokenizer into 2 fields. I also  
lose the casing (although this is a lesser issue).

On the other hand, if I facet on the non-analyzed version of the field, I  
get:

"["SomeTag", "SomeOtherTag", "Some.Tag3"]" : 1,  
"["SomeTag", "Some.Tag3"]": 1,  
"["SomeTag"]": 1

Which is, of course, absolutely correct but not what I want.

So... How can I tell elastic to parse the _list_ but not the _contents_ of  
each entry?

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [October 22, 2013, 11:57am UTC](https://discuss.elastic.co/t/analyzing-a-list-without-analyzing-the-values-in-the-list-for-facetting/14055/2 "2013-10-22T11:57:55Z")

</div>

You did not give the commands how you created the documents, but I think  
there must be an error.

In this example [https://gist.github.com/jprante/7099277](https://gist.github.com/jprante/7099277) everythings works  
as expected.

Jörg

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Simon\_Orr](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Simon\_Orr](https://discuss.elastic.co/u/Simon_Orr)\
**Post date:** [October 22, 2013, 1:00pm UTC](https://discuss.elastic.co/t/analyzing-a-list-without-analyzing-the-values-in-the-list-for-facetting/14055/3 "2013-10-22T13:00:21Z")

</div>

Thanks for the reply.

Your example does indeed work as expected (I had to tweak it slightly as we  
have auto-mapping turned off, so changed "_default_" to "data") but the  
main point holds true.

Our index mapping is being created by a Java program based on a document  
definition which is shared between multiple services.

What's really interesting is that reading the mappings back from elastic  
results in identical definitions for your test index and mine...

```
  "tags" : {
    "type" : "multi_field",
    "fields" : {
      "tags" : {
        "type" : "string"
      },
      "raw" : {
        "type" : "string",
        "index" : "not_analyzed",
        "omit_norms" : true,
        "index_options" : "docs",
        "include_in_all" : false
      }
    }
  }

```

"Tags" : {  
"type" : "multi\_field",  
"fields" : {  
"Tags" : {  
"type" : "string"  
},  
"Raw" : {  
"type" : "string",  
"index" : "not\_analyzed",  
"omit\_norms" : true,  
"index\_options" : "docs",  
"include\_in\_all" : false  
}  
}  
},

In any case, thanks for taking the time to point out that it should be  
working - Clearly there's something funky going on, either in the way the  
index is being created or in the way documents are being passed for  
indexing.

At least I've got an idea where to look now - thanks again.

- Simon

On Tuesday, October 22, 2013 12:57:55 PM UTC+1, Jörg Prante wrote:

> You did not give the commands how you created the documents, but I think  
> there must be an error.
> 
> In this example [Demonstration of facets with multi\_field · GitHub](https://gist.github.com/jprante/7099277) everythings works  
> as expected.
> 
> Jörg

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:11am UTC](https://discuss.elastic.co/t/analyzing-a-list-without-analyzing-the-values-in-the-list-for-facetting/14055/4 "2017-07-06T02:11:10Z")

</div>


