elasticsearch-mapping

Elasticsearch sort by custom created_at field

与世无争的帅哥 提交于 2021-02-20 02:45:28
问题 I've got a created_at field in my Elastic Search database and I'm trying to pull out data and sort it by that field. The field was stored with a mapping property with the date format, with the fielddata key set to true , but I still get the error: Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [created_at] in

How to set default mapping to “keyword” for dynamically added properties in Elasticsearch

 ̄綄美尐妖づ 提交于 2021-02-11 15:31:27
问题 In our application we add new documents which can have new unknown properties. Is it possible to set default mapping to "keyword" for dynamically added new properties in Elasticsearch? 回答1: Dynamic template doc has an example for type string. Also in case you don't already use index templates read the relevant doc as the dynamic template can be specify with CREATE INDEX API but more commonly in the index template 回答2: This, this, and this should be enough to get you started. When in doubt,

Elasticsearch Java API: Object mapping for [eventDefinitions] tried to parse field [null] as object, but found a concrete value?

 ̄綄美尐妖づ 提交于 2020-03-03 12:15:11
问题 I am trying to make a mapping for the following document work: { "eventDatabase": "abc", "usageLibraryEventType": "ABC", "name": "Prionti", "namespace": "Prionti's namespace", "latestBuildTimestamp": 1581348323634, "flattenedEventProperties": [ "User Id" ], "eventDefinitions": [ { "buildInfo": { "baseVersion": "1", "branch": "master", "buildName": "something.com", "orgName": "Prionti's org", "repoName": "myrepo", "buildTimestamp": 1581348323634, "packageName": "myrepo", "packagePath": "",

Does elasticsearch consider empty string as null?

南楼画角 提交于 2020-01-25 08:43:07
问题 I would like to know if elasticsearch considers empty string as null value, but based on my mapping shown below, I don't see that it is doing that. How can I make elasticsearch consider empty string as a null and index using the value provided by null_value . My mapping is shown below: { "mapping": { "my_typee": { "properties": { "autoRank": { "type": "integer", "null_value": 0, "store": true, "index": "analyzed" } } } } } Thanks in advance. 回答1: Ealsticsearch does not index empty strings. In

elasticsearch mapping analyzer - GET not getting result

浪子不回头ぞ 提交于 2020-01-07 02:48:31
问题 I am trying to create an analyzer, which replaces special character with a whitespace and convert it into uppercase. then after, if I want to search with lowercase also it should work. Mapping Analyzer: soundarya@soundarya-VirtualBox:~/Downloads/elasticsearch-2.4.0/bin$ curl -XPUT 'http://localhost:9200/aida' -d '{ "settings": { "analysis": { "analyzer": { "my_analyzer": { "tokenizer": "standard", "char_filter": [ "my_char_filter" ], "filter": [ "uppercase" ] } }, "char_filter": { "my_char

remove field and add new field to the mapping in elastic search index

廉价感情. 提交于 2020-01-02 19:33:10
问题 I made a mistake at the time of first index creation for one field. Instead of "integer" data type mistakenly I assigned as "string" for the field "rating". But the data stored in the field was integer only. When I'm trying to calculate the average rating aggregation it was throwing an error because of the string data type. Is there a way to change the data type of the field with out reindexing? If not possible without reindex, how can I remove the rating field and add a rating field with

remove field and add new field to the mapping in elastic search index

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-02 19:33:08
问题 I made a mistake at the time of first index creation for one field. Instead of "integer" data type mistakenly I assigned as "string" for the field "rating". But the data stored in the field was integer only. When I'm trying to calculate the average rating aggregation it was throwing an error because of the string data type. Is there a way to change the data type of the field with out reindexing? If not possible without reindex, how can I remove the rating field and add a rating field with

Elasticsearch date query. People who were born in a certain month

▼魔方 西西 提交于 2019-12-24 11:26:51
问题 I have a field with the following mapping: birthdate: { type: :date, format: :dateOptionalTime } I need to find everyone who were born in month of May (including all years) Another query is to find all people who were born on 'August 25' (including all years) What would be the query for that? 回答1: You can achieve this with a script filter All people born in May of any year: { "query": { "filtered": { "filter": { "script": { "script": "doc.birthdate.date.monthOfYear == 5" } } } } } All people