elasticsearch-2.0

IllegalStateException for mixing up field types

断了今生、忘了曾经 提交于 2019-12-06 07:22:40
My JSON (TMPOI_TEMPLATE) { "addressInfo": { "geopoint": { "lon": 48.845877, "lat": 8.821861, } }, "poiLocation": { "geopoint": { "lon": 48.845877, "lat": 8.821861, }, "speed": 3.0, "date": 1461067375605 }, "_id": "f212949c-7b67-45db-9f76-fe18bf951722" } My Mappings (TMPOI_MAPPING) { "trafficmeasurepoi": { "properties": { "addressInfo": { "properties": { "geopoint": { "type" : "geo_point" }, } }, "poiLocation": { "properties": { "geopoint": { "type" : "geo_point" }, "speed": { "type" : "double"}, "date": { "type" : "date"} } } } } } My method to fill the index Index is created by another method

Elasticsearch 2.4, Exists filter for nested objects not working

淺唱寂寞╮ 提交于 2019-12-06 03:37:40
My mapping is: "properties": { "user": { "type": "nested", "properties": { "id": { "type": "integer" }, "is_active": { "type": "boolean", "null_value": false }, "username": { "type": "string" } } }, I want to get all documents that do not have a user field. I tried: GET /index/type/_search { "query": { "bool": { "must_not": [ { "exists": { "field": "user" } } ] } } } Which returns all documents. Based on ElasticSearch 2.x exists filter for nested field doesn't work , I also tried: GET /index/type/_search { "query": { "nested": { "path": "user", "query": { "bool": { "must_not": [ { "exists": {

case insensitive elasticsearch with uppercase or lowercase

我的梦境 提交于 2019-12-04 17:45:54
I am working with elastic search and I am facing a problem. if any body gave me a hint , I will really thankful. I want to analyze a field "name" or "description" which consist of different entries . e.g someone want to search Sara. if he enter SARA, SAra or sara. he should be able to get Sara. elastic search uses analyzer which makes everything lowercase. I want to implement it case insensitive regardless of user input uppercase or lowercase name, he/she should get results. I am using ngram filter to search names and lowercase which makes it case insensitive. But I want to make sure that a

Elasticsearch 2.0: how to delete by query in Java

若如初见. 提交于 2019-12-04 04:58:54
I am trying to upgrade to ES 2.0. I have downloaed ES 2.0 and installed it on my Windows machine. In my pom.xml, I have the following: <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>2.0.0-rc1</version> </dependency> <dependency> <groupId>org.elasticsearch.plugin</groupId> <artifactId>delete-by-query</artifactId> <version>2.0.0-rc1</version> </dependency> In my Java code, I did delete by query in the following way when using ES 1.7.3: StringBuilder b = new StringBuilder(""); b.append("{"); b.append(" \"query\": {"); b.append(" \"term\": {"); b

Does Mongo-connector supports adding fields before inserting to Elasticsearch?

情到浓时终转凉″ 提交于 2019-12-02 15:31:36
问题 I have many docements in mongoDB. Mongo-connector inserts those data to elasticsearch. Is there a way, before inserting in to ES where we can add extra field to the document and then insert into elasticsearch? Is there any way in mongo-connector to do the above? UPDATE based on your UPDATE 3 i created mappings some thing like this is it correct? PUT my_index2 { "mappings":{ "my_type2": { "transform": { "script": { "inline": "if (ctx._source.geopoint.alt) ctx._source.geopoint.remove('alt')",

Elasticsearch - use a “tags” index to discover all tags in a given string

南楼画角 提交于 2019-12-02 12:47:06
I have an elasticsearch v2.x cluster with a "tags" index that contains about 5000 tags: {tagName, tagID} . Given a string, is it possible to query the tags index to get all tags that are found in that string? Not only do I want exact matches, but I also want to be able to control for fuzzy matches without being too generous. By too generous, a tag should only match if all tokens in the tag are found within a certain proximity of each other (say 5 words). For example, given the string: Model 22340 Sound Spectrum Analyzer The following tags should match: sound analyzer sound spectrum analyzer

elasticsearch 2.0 parent child grandchild

孤街浪徒 提交于 2019-12-02 05:16:57
问题 My operation: parent: country, child: branch, grandchild: employee PUT /company { "mappings": { "branch": { "_parent": { "type": "country" } }, "employee": { "_parent": { "type": "branch" } } } } I want add a grandchild employee2, parent is branch: PUT /company/employee2/_mapping { "employee2": { "_parent": { "type": "branch" } } } I get wrong message: { "error": { "root_cause": [ { "type": "illegal_argument_exception", "reason": "can't add a _parent field that points to an already existing

Children aggregation broken in Elasticsearch 2.1?

此生再无相见时 提交于 2019-12-02 01:06:33
In investigating the issue in this question I noticed what seems to be a bug in Elasticsearch 2.1. Did I miss one of the breaking changes, or is this an actual bug? With this setup: PUT /test_index { "mappings": { "parent_doc": { "properties": { "name": { "type": "string", "index": "not_analyzed" }, "town": { "type": "string", "index": "not_analyzed" } } }, "child_doc": { "_parent": { "type": "parent_doc" }, "properties": { "name": { "type": "string", "index": "not_analyzed" }, "age": { "type": "integer" } } } } } POST /test_index/parent_doc/_bulk {"index":{"_id":1}} {"name":"Bob","town":

Looking for Elasticsearch updateByQuery syntax example (Node driver)

瘦欲@ 提交于 2019-12-01 18:42:05
You have an Elasticsearch index with two docs: [ { "_index": "myIndex", "_type": "myType", "_id": "es1472002807930", "_source": { "animal": "turtle", "color": "green", "weight": 20, } }, { "_index": "myIndex", "_type": "myType", "_id": "es1472002809463", "_source": { "animal": "bear", "color": "brown" "weight": 400, } } ] Later, you get this updated data about the bear: { "color": "pink", "weight": 500, "diet": "omnivore", } So, you want to update the "color" and "weight" values of the bear, and add the "diet" key to the "bear" doc. You know there's only one doc with "animal": "bear" (but you

ElasticSearch (2.2) Java filter between startDate and endDate if exists

送分小仙女□ 提交于 2019-12-01 12:50:21
I want to have following filter with elasticsearch (java client): If startDate exists and lower then now If endDate exists and greater then now I already have following but it doesn't show the once which have no startDate or endDate: //Start date end date BoolQueryBuilder queryBuilder = new BoolQueryBuilder(); queryBuilder.filter(QueryBuilders.rangeQuery("startDate").lte("now")); queryBuilder.should(QueryBuilders.existsQuery("startDate")); queryBuilder.filter(QueryBuilders.rangeQuery("endDate").gte("now")); queryBuilder.should(QueryBuilders.existsQuery("endDate")); boolQueryBuilder.filter