Re: How to search such values :- 1/2"-12

2015-06-12 Thread Muddadi Hemaanusha
You can use prefix query hope so.

 "query": {
  "prefix": {
 "*Data*": {
"value": "*1/2"-12*"
 }
  }
   }

On Thursday, June 4, 2015 at 6:39:10 PM UTC+5:30, Mohit Kumar Yadav wrote:
>
> Hello Folks,
>
> I have a such data
>
>
> *doc1 ->  { "Data" : "1/2"-12"}*
> *doc2 ->  { "Data" : "3/4"-22"}*
> *doc3 ->  { "Data" : "1/8"-42"}*
> *doc4 ->  { "Data" : "4/13"-2"}*
> *doc5 ->  { "Data" : "13/24"-27"} *
>
> where data is mapped as a string. *{"Data":{"type":"String"}}*
>
> I am using following query for search :- 
>
> *{"query_string": {"query": "Data:1\\/2\\\"-12"}}*
>
> but I am getting irrelevant response.
>  
> Can you please suggest me some ways to track it..
>
> Thanks in advance...!!
>
> Thanks 
> Mohit
>
>
>
>
>  

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/d816ad10-2acc-4122-8d89-072a823df5b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Search for parts of a string array in elasticsearch

2015-06-12 Thread Muddadi Hemaanusha
This will be the equivalent API..

boolQueryBuilder.must(QueryBuilders.termsQuery("field", 
"value1","value2","value3").minimumMatch(3));


On Friday, June 12, 2015 at 6:02:31 PM UTC+5:30, Muddadi Hemaanusha wrote:
>
> Hi,
>
> You can use terms query to match N number of values in field in different 
> documents by,
>
> {
> "terms" : {
> "field" : [ "value1", "value2", "value3" ],
> "minimum_should_match" : 3
> }}
>
> Here you can specify minimum should match, 
> if you want only only value matched docs then 1 or else to match all the 
> values matched docs keep as 3 or else only 2 values then keep 2.
>
>
>
> On Wednesday, June 10, 2015 at 1:31:54 PM UTC+5:30, Vipin Sudhakar wrote:
>>
>> Hi, 
>>
>> I have a requirement, where i have to search for the filed 
>> values(value1,value2 and value3) from elasticsearch. 
>>
>> But these values will be available from three differetn documents. 
>>
>> How can i make a ES query? 
>>
>> Currently i have single value for the filed and the query goes as below; 
>>
>> boolQueryBuilder.must(QueryBuilders.matchQuery(fieldName, 
>>value); 
>>
>> How shud i modify the query to suppor the array of string values 
>> selection. 
>>
>> Thanks, 
>> Sumitha. 
>>
>>
>>
>>
>> -- 
>> View this message in context: 
>> http://elasticsearch-users.115913.n3.nabble.com/Search-for-parts-of-a-string-array-in-elasticsearch-tp4075074.html
>>  
>> Sent from the Elasticsearch Users mailing list archive at Nabble.com. 
>>
>

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/fecfa130-7d2a-492d-b86e-9c782d8f40ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Search for parts of a string array in elasticsearch

2015-06-12 Thread Muddadi Hemaanusha
Hi,

You can use terms query to match N number of values in field in different 
documents by,

{
"terms" : {
"field" : [ "value1", "value2", "value3" ],
"minimum_should_match" : 3
}}

Here you can specify minimum should match, 
if you want only only value matched docs then 1 or else to match all the values 
matched docs keep as 3 or else only 2 values then keep 2.



On Wednesday, June 10, 2015 at 1:31:54 PM UTC+5:30, Vipin Sudhakar wrote:
>
> Hi, 
>
> I have a requirement, where i have to search for the filed 
> values(value1,value2 and value3) from elasticsearch. 
>
> But these values will be available from three differetn documents. 
>
> How can i make a ES query? 
>
> Currently i have single value for the filed and the query goes as below; 
>
> boolQueryBuilder.must(QueryBuilders.matchQuery(fieldName, 
>value); 
>
> How shud i modify the query to suppor the array of string values 
> selection. 
>
> Thanks, 
> Sumitha. 
>
>
>
>
> -- 
> View this message in context: 
> http://elasticsearch-users.115913.n3.nabble.com/Search-for-parts-of-a-string-array-in-elasticsearch-tp4075074.html
>  
> Sent from the Elasticsearch Users mailing list archive at Nabble.com. 
>

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/78cd197d-d1cf-4891-a2b2-456aec1d8f1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


mapping error

2015-06-12 Thread Mahesh Sankaran
Hi all, 

This is my mapping. 

curl http://localhost:9200/indexname/_mapping/log?pretty
{ 
  "fortigate" : { 
"mappings" : { 
  "log" : { 
"properties" : { 
  "@timestamp" : { 
"type" : "date", 
"format" : "dateOptionalTime" 
  }, 
  "@version" : { 
"type" : "string" 
  }, 
  
  "duration" : { 
"type" : "string" 
  }, 
  "geoip" : { 
"properties" : { 
  "area_code" : { 
"type" : "long" 
  }, 
  
  "location" : { 
"type" : "double" 
  }, 
  "longitude" : { 
"type" : "double" 
  }, 
  "postal_code" : { 
"type" : "string" 
  }, 
  "real_region_name" : { 
"type" : "string" 
  }, 
  "region_name" : { 
"type" : "string" 
  }, 
  "timezone" : { 
"type" : "string" 
  } 
} 
  }, 
  "group" : { 
"type" : "string" 
  }, 
  "host" : { 
"type" : "string" 
  }, 
  "hostname" : { 
"type" : "string" 
  }, 
  "identix" : { 
"type" : "string" 
  }, 
  "level" : { 
"type" : "string" 
  }, 
  "logid" : { 
"type" : "string" 
  }, 
  "mastersrcmac" : { 
"type" : "string" 
  }, 
  "message" : { 
"type" : "string" 
  }, 
  "month" : { 
"type" : "string" 
  }, 
  "osname" : { 
"type" : "string" 
  }, 
  
  "vd" : { 
"type" : "string" 
  }, 
  "year" : { 
"type" : "string" 
  } 
} 
  } 
} 
  } 
} 
I want to change the 'location' field type into geo_point under geoip.I 
tried to change by using following curl command. 

curl -XPUT 'http://localhost:9200/fortigate/log/_mapping' -d ' 
{ 
"geoip" : { 
"properties" : { 
"location" : {"type" : "geo_point"} 
} 
} 
}' 

But it shows the following error. 

{"error":"MapperParsingException[Root type mapping not empty after parsing! 
Remaining fields:   [geoip : 
{properties={location={type=geo_point}}}]]","status":400} 

Kindly help me to solve this issue. 

Thanks 

Mahesh 

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/60da781d-e8b2-4c22-ab00-c865c0807e8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.