You have to use PUT method to add data to elasticsearch.
Example:
`$ curl -XPUT 'http://localhost:9200/products/product/123' -d '{
"ProductID": 123,
"SellingPrice": 1200.00,
"DiscountAmount":0.00,
"Discount": {
"Type": "percentage",
"Amount": 25,
"StartDate": "2014-08-13T12:05:00",
"EndDate": "2014-12-31T12:10:00"
}
}'`
CURL library can be used to send data to your elasticsearch. For testing purpose you can use [chrome sense plugin][1].
For getting aggregation use POST or GET method.
Example:
`$ curl -XGET 'http://localhost:9200/products/product/_search?search_type=count' -d '{
"aggregations": {
"my_agg": {
"terms": {
"field": "SellingPrice"
}
}
}
}
'`
Above example will return aggregation result as below:
`{
"took": 48,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 117,
"max_score": 0,
"hits": []
},
"aggregations": {
"my_agg": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 1200,
"doc_count": 1
}
]
}
}
}`
[1]: https://chrome.google.com/webstore/detail/sense-beta/lhjgkmllcaadmopgmanpapmpjgmfcfig?hl=en
Спасибо за ответ, я знаю, как добавить данные, но проблема в том, что я хочу, чтобы хранить не анализируемые данные слишком –
Использование карт следующим образом: '" Name ": { " type ":" string ", " store ": true, " index_analyzer ":" index_analyzer ", " search_analyzer ":" search_an alyzer», "полей": { "оригинала": { "типа": "строка", "Индекс": "not_analyzed" } } }' ' вы можете искать 'не проанализированных поле' например «Name.original» – Bala
Я не знаю имен полей –