Skip to content

Conversation

@jpountz
Copy link
Contributor

@jpountz jpountz commented Mar 18, 2016

If you add a string field to a document, it will have the following default
mapping:

{
  "type": "text",
  "fields": {
    "keyword": {
      "type": "keyword",
      "ignore_above": 256
    }
  }
}

@jpountz jpountz added >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types v5.0.0-alpha1 labels Mar 18, 2016
@rjernst
Copy link
Member

rjernst commented Mar 23, 2016

Is the intention here supposed to be to allow users to use aggregations on any json string "by default"? This means the data would then be indexed 3 times, once in the field, once in _all, and once in the keyword subfield. If I was correct above, then do we really need this subfield to be indexed, or could it just be there for doc values? I'm also more of a fan of "original" then for the name.

@jpountz
Copy link
Contributor Author

jpountz commented Mar 23, 2016

Your assumptions are correct. Indexing the sub field is useful so that if the user runs eg. a terms aggregations to build a pie chart, then we can build a filter on the same field when (s)he clicks on one piece of the chart. If we were to do it with the text field, we might also match values that have a different case for instance.

I used "keyword" because it was the suggested name on #12394 (see "Good out-of-the-box dynamic mappings for string fields").

@clintongormley
Copy link
Contributor

Personally I'm a fan of keyword as it says "this is the keyword variant of the main field". That said, Logstash has used raw for a long time, as has our documentation.

If we were to use keyword as the default name, Logstash could continue to use raw in the Logstash template to maintain bwc, but I'm guessing that Logstash would prefer to use our defaults instead. I'd rather make the right choice for the future, rather than using raw just for historical reasons, but I'm not sure that the choice between keyword vs raw is that clear cut.

Opinions welcome.

@jpountz
Copy link
Contributor Author

jpountz commented Mar 26, 2016

Should we merge it as-is so that this feature would be included in the alpha releases and we have feedback about this multi-field mapping by default? Then we can open a blocker issue about whether we want to change the naming for the GA.

@rjernst
Copy link
Member

rjernst commented Mar 26, 2016

+1 to merge

…stic#17188

If you add a string field to a document, it will have the following default
mapping:

```
{
  "type": "text",
  "fields": {
    "keyword": {
      "type": "keyword",
      "ignore_above": 256
    }
  }
}
```
@jpountz jpountz force-pushed the enhancement/add_keyword_to_dynamic_mappings branch from 82d7de2 to 0eedc78 Compare March 29, 2016 07:50
@jpountz jpountz merged commit 0eedc78 into elastic:master Mar 29, 2016
@jpountz jpountz deleted the enhancement/add_keyword_to_dynamic_mappings branch March 29, 2016 07:51
rjernst added a commit to rjernst/elasticsearch that referenced this pull request Apr 22, 2016
The getting started docs use dynamic mappings. With the recent change to
string split into text and keyword, text lost the default ability to do
aggs. This was added back in elastic#17188. This change updates the getting
started examples to use the keyword multi field added to dynamically
mapped text fields.

closes elastic#17941
@djschny
Copy link
Contributor

djschny commented Apr 29, 2016

Do we really want to couple the name of the mult-field to the the analyzer type? keyword analzyer really should be called noop anyway because that is how it behaves and we even explain it that way to people.

@jpountz
Copy link
Contributor Author

jpountz commented Apr 29, 2016

@djschny I believe the idea was more to couple it with the field type than the analyzer type. Please open a new issue if you think this should be changed to something else.

danielmitterdorfer added a commit to elastic/elasticsearch-definitive-guide that referenced this pull request Apr 11, 2017
danielmitterdorfer pushed a commit to elastic/elasticsearch-definitive-guide that referenced this pull request Apr 11, 2017
danielmitterdorfer added a commit to danielmitterdorfer/elasticsearch-definitive-guide that referenced this pull request Apr 11, 2017
With this commit we correct use `keyword` subfields in all
aggregation-related examples in the intro chapter. They are needed since
Elasticsearch 5.0 as text-fields do not have fielddata enabled.

Relates elastic/elasticsearch#17188
danielmitterdorfer added a commit to elastic/elasticsearch-definitive-guide that referenced this pull request Apr 18, 2017
With this commit we correct use `keyword` subfields in all
aggregation-related examples in the intro chapter. They are needed since
Elasticsearch 5.0 as text-fields do not have fielddata enabled.

Relates elastic/elasticsearch#17188
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types v5.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants