Reputation: 45
Bit confused.
I'm using jackson to parse JSON strings into maps that will then be accepted in elasticsearch.
That works fine.
However due to the JSON specifications, all integers and other formats need to be sent through as a string - aka - "key":"value"
. But then elasticSearch sees them as strings, not numbers. Which makes totaling values like user ratings not possible when it should be trivial.
How can I use the JSON format to input numbers/integers into elasticsearch?
Is there a way around this?
Upvotes: 1
Views: 8156
Reputation: 12698
You may need to create a mapping for your index.
Mapping is the process of defining how a document, and the fields it contains, are stored and indexed. For instance, use mappings to define:
https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html
If you already have a some existing data that you don't want to lose you'll need to reindex after updating your mapping. Due to how ES indexes data you can not change the type after it's been created.
https://www.elastic.co/blog/changing-mapping-with-zero-downtime https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-reindex.html
Upvotes: 3