children aggregation

2015-03-10 Thread kazoompa
Hi,

I was wondering whether this aggregation will work with parent documents 
residing in different indexes than the children documents? Are there any 
limitations with respect to shards? I remember parent-child relationships 
have shard limitation as stated here: http://goo.gl/gU6Mcx.

In short, I would like to know the limitations of this aggregation type 
since there were none described in the children agg 
documentation: http://goo.gl/Y3yfhc.


Thanks a lot.

-- 
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/055b8b28-d403-483e-92cb-a1b3ae04b252%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


HOW: Retrieve Terms aggregation's grand total of all bucket doc_counts

2015-02-21 Thread kazoompa
Hi,

Is there an ES way to get a grand total of doc_count of all buckets of a 
Terms aggregation? For instance to get 20 for the following:

{

"aggregations" : {
"genders" : {
"buckets" : [
{
"key" : "male",
"doc_count" : 10
},
{
"key" : "female",
"doc_count" : 10
},
]
}
}
}


I am hoping of a hidden option in the query syntax that doesn't slow down 
the query.

Thanks a lot.

-- 
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/39340e70-65f5-4656-8f31-33e4ef7767e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Java annotations for JUnit testing with elasticsearch

2014-12-22 Thread kazoompa
HI Tanguy,

Is this library still maintained for the newer versions of ES, for example 
1.4.0?

Thanks,
Ramin



On Wednesday, November 7, 2012 4:39:16 AM UTC-5, Tanguy wrote:
>
> Hi,
>
> Just to let you know - version 0.0.5 of this test library for JUnit & 
> Elasticsearch has been released on OSS maven repositories.
> https://github.com/tlrx/elasticsearch-test
> https://oss.sonatype.org/content/repositories/releases/com/github/tlrx/
>
> I (and other folks) use it on production and it works well. I hope it will 
> be helpful for other people as well :o)
>
> -- Tanguy
> Twitter: @tlrx
> https://github.com/tlrx/
>

-- 
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/5098ba86-5c72-4bc2-98b1-3d77b1168d6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: what would be the effect of using an arbitrary large count

2014-12-04 Thread kazoompa
I am still not expert an in ES but surely when not paging the process time 
will be higher because more documents have to be brought back in the 
response. However, depending on what kind of queries you perform, the 
subsequent queries will be faster. I am thinking of *filter bool queries* 
with caching and bitset query representation. I doubt that a size of *1m* 
will have any effect if there are only 100 documents indexed.

I wouldn't advise removing the paging for the sake of bandwidth and network 
traffic especially if you have many clients using the same server, may be a 
very optimized server setup can help.

We do a full query only when doing statistical calculation requiring all 
documents.





On Wednesday, December 3, 2014 11:40:05 PM UTC-5, Ron Sher wrote:
>
> Hi 
> We have a multi tenant SaaS solution and we expose our use of 
> elasticsearch through an API. We noticed that clients who use the API 
> directly, and not through our front-end, don't bother with paging and just 
> use a count of 500k or 1m even if the actual count is much lower. I was 
> wondering about the effect of not limiting the count since we're thinking 
> of making a breaking change and limit this to 100. 
>
> Thanks for your help 
> Ron

-- 
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/51e07a71-3649-4e99-9217-21b0f32b20b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: data visualization with elasticsearch aggregations and d3 explaining

2014-12-04 Thread kazoompa
You really need to go over the query documentation first, there are plenty 
of good examples and tutorials that will guide you and help you understand 
your snippet.

I gather you understand the query part, the aggregation part (there are 
lots of docs) shows the frequency (count) of touchdowns on field "qtr".

You really need to dive into the docs :)



On Thursday, December 4, 2014 2:00:56 AM UTC-5, Mohd Syafiq wrote:
>
> Hi guys, i want to build graph using d3 and query from elassticsearch, but 
> anyone here tell me what exactly mean by this code ? 
>
>
>  client.search({
> index: 'nfl',
> size: 5,
> body: {
> // Begin query.
> query: {
> // Boolean query for matching and excluding items.
> bool: {
> must: {
>  match: { 
> "description": "TOUCHDOWN" 
>   // "season": "2012"
> }
> },
> must_not: { match: { "qtr": 5 }}
> }
> },
> // Aggregate on the results
> aggs: {
> touchdowns: {
> terms: {
> field: "qtr",
> order: { "_term" : "asc" }
> }
> }
> }
> // End query.
> }
>

-- 
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/230e182a-529e-4343-8cb6-3eb7a39f2fa7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Nested Aggregations

2014-12-03 Thread kazoompa
Hi,

I have two queries with identical nested aggregations using *min_doc_count* *= 
0* option. The only difference is in the queries, first query is a 
*match_all()* and the other a filtered query. The filtered query's 
aggregations miss bucket keys here and there! I was expecting an exact 
number of aggregation buckets with expected different counts. In the 
documentation http://is.gd/Mvueh1 there are notes about possible inaccuracy 
of min_doc_count, what I miss to understand is why the *match_all()* query 
doesn't have this problem.

Below is an example of my two responses:


This is the reponse for *match_all()* query:
"Sociodemographic_economic_characteristics-und" : {
  "buckets" : [ {
"key" : "Age",
"doc_count" : 30
  }, {
"key" : "Birth_place",
"doc_count" : 4
  }, {
"key" : "Education",
"doc_count" : 5
  }, {
"key" : "Ethnic_race_religion",
"doc_count" : 0
  }, {
"key" : "Family_hh_struct",
"doc_count" : 22
  }, {
"key" : "Income",
"doc_count" : 5
  }, {
"key" : "Labour_retirement",
"doc_count" : 9
  }, {
"key" : "Language",
"doc_count" : 2
  }, {
"key" : "Marital_status",
"doc_count" : 31
  }, {
"key" : "Other_sociodemogr_chars",
"doc_count" : 0
  }, {
"key" : "Residence",
"doc_count" : 33
  }, {
"key" : "Sex",
"doc_count" : 11
  } ]
}

This is the response for the fitlered query:


"attributes-Mlstr_area__Sociodemographic_economic_characteristics-und" : {
  "buckets" : [ {
"key" : "Age",
"doc_count" : 0
  }, {
"key" : "Birth_place",
"doc_count" : 0
  }, {
"key" : "Education",
"doc_count" : 0
  }, {
"key" : "Ethnic_race_religion",
"doc_count" : 0
  }, {
"key" : "Family_hh_struct",
"doc_count" : 0
  }, {
"key" : "Income",
"doc_count" : 0
  }, {
"key" : "Labour_retirement",
"doc_count" : 0
  }, {
"key" : "Language",
"doc_count" : 2
  }, {
"key" : "Marital_status",
"doc_count" : 0
  }, {
"key" : "Residence",
"doc_count" : 0
  }, {
"key" : "Sex",
"doc_count" : 0
  } ]
}


The missing bucket is for key *Other_sociodemogr_chars*.

Any insight is greatly appreciated.

-- 
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/f5d1f871-1fe2-405f-9ea5-03725a0b6dbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


min_document_doc in nested aggregations

2014-11-20 Thread kazoompa
Hi,

I have several aggregations each of which have their own inner 
aggregations. It seems that the 'min_document_doc' does not apply when 
their containing aggregation is itself empty. I presumed that because both 
level of aggregations use 'min_document_doc' there would be buckets for the 
inner agg as well.

Can somebody enlighten me on why ES cannot do this, sort of a technical 
insight would be appreciated.

Thanks.


Here is a snippet of my query:
...
  "aggregations": {
"totalCount": {
  "global": {}
},
"categories-missing": {
  "terms": {
"field": "categories.missing",
"size": 0,
"min_doc_count": 0,
"order": {
  "_term": "asc"
}
  }
},
"datasetId": {
  "terms": {
"field": "datasetId",
"size": 0,
"min_doc_count": 0,
"order": {
  "_term": "asc"
}
  },
  "aggregations": {
"attributes-Default": {
  "terms": {
"field": "attributes.Default",
"size": 0,
"min_doc_count": 0,
"order": {
  "_term": "asc"
}
  }
},
"attributes-Administrative_information": {
  "terms": {
"field": "attributes.Administrative_information",
"size": 0,
"min_doc_count": 0,
"order": {
  "_term": "asc"
}
  }
},
...


-- 
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/d00b5831-351e-4f36-9197-9d56928667eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Looking for a sexy solution for Aggregations

2014-11-09 Thread kazoompa
Hi,

Consider the aggregation below:

"Sociodemographic_economic_characteristics": {
  "terms": {
"field": "Sociodemographic_economic_characteristics",
"size": 0,
"min_doc_count": 0,
"order": {
  "_term": "asc"
}
  }
}

This is the result without any filters:

Enter code here...

   - Sociodemographic_economic_characteristics: {
  - buckets: [
 - {
- key: Age
- doc_count: 93
 }
 - {
- key: Education
- doc_count: 42
 }
 - {
- key: Ethnic_race_religion
- doc_count: 17
 }
 - {
- key: Family_hh_struct
- doc_count: 55
 }
 - {
- key: Income
- doc_count: 10
 }
 - {
- key: Labour_retirement
- doc_count: 150
 }
 - {
- key: Marital_status
- doc_count: 20
 }
 - {
- key: Residence
- doc_count: 20
 }
 - {
- key: Sex
- doc_count: 7
 }
  ]
   }


This is the result with the filter:


   - Sociodemographic_economic_characteristics: {
  - buckets: [
 - {
- key: Age
- doc_count: 0
 }
 - {
- key: Education
- doc_count: 0
 }
 - {
- key: Ethnic_race_religion
- doc_count: 0
 }
 - {
- key: Family_hh_struct
- doc_count: 0
 }
 - {
- key: Income
- doc_count: 0
 }
 - {
- key: Labour_retirement
- doc_count: 150
 }
 - {
- key: Marital_status
- doc_count: 0
 }
 - {
- key: Residence
- doc_count: 0
 }
 - {
- key: Sex
- doc_count: 0
 }
  ]
   }


I would like to find a way to have the two combined ine one query search 
such that the client can show the info in this manner:

Age: 0/93
Education: 0/42
Ethnic_race_religion: 0/17
Family_hh_struct: 0/55
Income: 0/10
Labour_retirement:150/150
...


As alternatives, I considered doing a Multiple Search or two independent 
search queries, but is there any way to do this in one go using the 
Elasticsearch goodies (nested aggs, etc)

Thanks,
Ramin




-- 
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/350c0c57-4f4d-41a0-ab37-e5075b2ddccb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: elastic search date range aggregation not giving complete data

2014-11-05 Thread kazoompa
What do you mean by " I have also required complete aggregate data", you 
result is based on the type of the aggregation you use.

may be you can elaborate more.

Ramin

On Monday, November 3, 2014 11:33:55 PM UTC-5, Rajit Garg wrote:
>
> **I am Querying for getting aggregate data based on date_range, like 
> below**
>
> "aggs": {
> "range": {
> "date_range": {
> "field": "sold",
> "ranges": [
> {  "from": "2014-11-01", "to": "2014-11-30" },
> {  "from": "2014-08-01", "to": "2014-08-31" } 
> ]
> }
> }
> }
>
>
> **using this I am getting this response**
>
>
>  
>
> "aggregations": {
> "range": {
>   "buckets": [
> {
>   "key": "2014-08-01T00:00:00.000Z-2014-08-31T00:00:00.000Z",
>   "from": 140685120,
>   "from_as_string": "2014-08-01T00:00:00.000Z",
>   "to": 140944320,
>   "to_as_string": "2014-08-31T00:00:00.000Z",
>   "doc_count": 1
> },
> {
>   "key": "2014-11-01T00:00:00.000Z-2014-11-30T00:00:00.000Z",
>   "from": 14148,
>   "from_as_string": "2014-11-01T00:00:00.000Z",
>   "to": 141730560,
>   "to_as_string": "2014-11-30T00:00:00.000Z",
>   "doc_count": 2
> }
>   ]
> }
>   }
>
> **but instead of only doc_count, I have also required complete aggregate 
> data that satisfy this range,
> is threre any way to get this..please help**
>

-- 
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/5a1b099c-76c0-402c-9f48-8f526bc24025%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bool Queries and MUST/SHOULD combinations

2014-11-05 Thread kazoompa
Thanks Ivan,

We finally opted for building our queries (thru a UI query builder) in a 
nested fashion as dscribed above, it seems to serve our need.

Cheers for the info though.

 

On Tuesday, November 4, 2014 11:55:27 AM UTC-5, Ivan Brusic wrote:
>
> Should clauses at the same time as must clauses are only important during 
> queries (not filters) since they contribute to the scoring for a document. 
> The should clauses will improve the score for the documents that match.
>
> -- 
> Ivan
>
> On Mon, Nov 3, 2014 at 5:51 PM, kazoompa > 
> wrote:
>
>> Thanks Ivan,
>>
>> We would like to create complex queries explained in this page: 
>> http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/combining-filters.html#bool-filter.
>>  
>> I have to admit I don't see why anybody would like to put MUSTs and SHOULDs 
>> at same level. After further analysis, it seems that if I like to do 
>> something like:
>>
>> (For this example conside A, B and, C as terms filters and 'in' implying 
>> their possible values:)
>>
>> A in [a1, a2,...] OR B in [b1, b2,...] AND C in [c1, c2. ...]  // order 
>> is important
>>
>>
>> I have to implement my bool filter as:
>>
>> {
>>   "bool": {
>> "must": [
>>   {
>> "bool": {
>>   "should": [
>> {
>>   "terms": {
>> "A": [
>>   "a1",
>>   "a2"
>> ]
>>   }
>> },
>> {
>>   "terms": {
>> "B": [
>>   "b1",
>>   "b2"
>> ]
>>   }
>> }
>>   ]
>> },
>> "terms": {
>>   "C": [
>> "c1",
>> "c2"
>>   ]
>> }
>>   }
>> ]
>>   }
>> }
>>
>>
>> It's sort of a Polish notation for queries ;)
>>
>> Cheers.
>>
>>
>>
>> On Monday, November 3, 2014 5:02:15 PM UTC-5, Ivan Brusic wrote:
>>>
>>> Must clauses are queries that must return a document. In the first 
>>> query, any document returned MUST have a location of Germany. The valueType 
>>> should clause is optional and actually pointless as a filter since it does 
>>> not contribute to scoring.
>>>
>>> Can you explain what your query should be doing in terms of boolean 
>>> logic?
>>>
>>> -- 
>>> Ivan
>>>
>>> On Sat, Nov 1, 2014 at 4:39 PM, kazoompa  wrote:
>>>
>>>> Hi,
>>>>
>>>> Below is my data and the two queries that I tested, first one failing 
>>>> and the latter working. I start to believe that if one wants to combine 
>>>> several SHOULD and MUST filters, the outer one must always be SHOULD. Is 
>>>> this a correct assumption? In our application, we have much more complex 
>>>> situation with several filters within each MUST and SHOULD. And lastly, 
>>>> where should place a MUST_NOT in this case?
>>>>
>>>> Many thanks.
>>>>
>>>>
>>>>
>>>> Here is my data:
>>>>
>>>> _index,_type,_id,_score,_source.id,_source.type,_source.valueType,_source.sentence,_source.location
>>>> "test","var","0","1","0","study","text","Lorem text is jumbled","spain"
>>>> "test","var","1","1","1","study","text","bla bla bla","spain"
>>>> "test","var","2","1","2","schema","decimal","ipsum","germany"
>>>> "test","var","3","1","3","study","integer","lorem","france"
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Here is my FAILING query:
>>>>
>>>> {
>>>>   "query": {
>>>> "filtered": {
>>>>   "query": {
>>>> "match_all": {}
>>>>   },
>>&

Re: Bool Queries and MUST/SHOULD combinations

2014-11-03 Thread kazoompa
Thanks Ivan,

We would like to create complex queries explained in this 
page: 
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/combining-filters.html#bool-filter.
 
I have to admit I don't see why anybody would like to put MUSTs and SHOULDs 
at same level. After further analysis, it seems that if I like to do 
something like:

(For this example conside A, B and, C as terms filters and 'in' implying 
their possible values:)

A in [a1, a2,...] OR B in [b1, b2,...] AND C in [c1, c2. ...]  // order is 
important


I have to implement my bool filter as:

{
  "bool": {
"must": [
  {
"bool": {
  "should": [
{
  "terms": {
"A": [
  "a1",
  "a2"
]
  }
},
{
  "terms": {
"B": [
  "b1",
  "b2"
]
  }
}
  ]
},
"terms": {
  "C": [
"c1",
"c2"
  ]
}
  }
]
  }
}

   
It's sort of a Polish notation for queries ;)

Cheers.



On Monday, November 3, 2014 5:02:15 PM UTC-5, Ivan Brusic wrote:
>
> Must clauses are queries that must return a document. In the first query, 
> any document returned MUST have a location of Germany. The valueType should 
> clause is optional and actually pointless as a filter since it does not 
> contribute to scoring.
>
> Can you explain what your query should be doing in terms of boolean logic?
>
> -- 
> Ivan
>
> On Sat, Nov 1, 2014 at 4:39 PM, kazoompa > 
> wrote:
>
>> Hi,
>>
>> Below is my data and the two queries that I tested, first one failing and 
>> the latter working. I start to believe that if one wants to combine several 
>> SHOULD and MUST filters, the outer one must always be SHOULD. Is this a 
>> correct assumption? In our application, we have much more complex situation 
>> with several filters within each MUST and SHOULD. And lastly, where should 
>> place a MUST_NOT in this case?
>>
>> Many thanks.
>>
>>
>>
>> Here is my data:
>>
>> _index,_type,_id,_score,_source.id,_source.type,_source.valueType,_source.sentence,_source.location
>> "test","var","0","1","0","study","text","Lorem text is jumbled","spain"
>> "test","var","1","1","1","study","text","bla bla bla","spain"
>> "test","var","2","1","2","schema","decimal","ipsum","germany"
>> "test","var","3","1","3","study","integer","lorem","france"
>>
>>
>>
>>
>>
>> Here is my FAILING query:
>>
>> {
>>   "query": {
>> "filtered": {
>>   "query": {
>> "match_all": {}
>>   },
>>   "filter": {
>> "bool": {
>>   "must": {
>> "terms": {
>>   "location": [
>> "germany"
>>   ]
>> }
>>   },
>>   "should": {
>> "terms": {
>>   "valueType": [
>> "integer"
>>   ]
>> }
>>   }
>> }
>>   }
>> }
>>   }
>> }
>>
>> Here is my WORKING query returning IDs 2 and 3:
>>
>> {
>>   "query": {
>> "bool": {
>>   "should": [
>> {
>>   "terms": {
>> "location": [
>>   "germany"
>> ]
>>   }
>> },
>> {
>>   "bool": {
>> "must": [
>>   {
>> "terms": {
>>   "valueType": [
>> "integer"
>>   ]
>> }
>>   }
>> ]
>>   }
>> }
>>   ]
>> }
>>   }
>> }
>>
>> -- 
>> 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 elasticsearc...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/d4597d15-8785-4e97-9c3f-8be9aacddf9b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/d4597d15-8785-4e97-9c3f-8be9aacddf9b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/a33a6974-4a95-4632-9c56-bea3d19ce7f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Better to use "must" and "terms", or "should", in a bool query?

2014-11-03 Thread kazoompa
You will only see the difference when you have more complex queries that 
combine MUST and SHOULD together. In your example you could have just 
change MUST to SHOULD (i.e. used TERMS). By the definition, SHOULD is like 
an OR and without a MUST clause it implies 'at least' one should match.

R

On Friday, January 10, 2014 11:17:57 AM UTC-5, Nick Hoffman wrote:
>
> Hi guys. These 2 queries produce the same results via different 
> approaches. Is there any reason why one should be used over another?
>
> Thanks,
> Nick
>
> {
>   "size": 10,
>   "fields": ["id", "name"],
>   "sort": [ { "name.orig": "asc" } ],
>   "query": {
> "bool": {
>   "must": [
> { 
>   "terms": {
> "catalog_ids": ["4736349c302bd14e", 
> "511a70be63051f6a64000217"],
> "minimum_should_match": 1
>   }
> }
>   ]
> }
>   }
> }
>
> {
>   "size": 10,
>   "fields": ["id", "name"],
>   "sort": [ { "name.orig": "asc" } ],
>   "query": {
> "bool": {
>   "minimum_should_match": 1,
>   "should": [
> { "term": { "catalog_ids": "4736349c302bd14e" } },
> { "term": { "catalog_ids": "511a70be63051f6a64000217" } }
>   ]
> }
>   }
> }
>
>

-- 
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/c8973ae2-2b7c-44d1-99f3-5c587acbdc51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bool Queries and SHOULD/MUST combinations

2014-11-01 Thread kazoompa
Thanks Jörg for the response, I had a mistake in my question and I had to 
delete and re-post it.

Here is how I did the indexing (never mind the data, it is randomly 
created) and I don't think there is any error in the method that I know of :

curl -XPUT 'http://localhost:9200/test/var/0' -d '{"id": "0", "type": 
"schema", "valueType": "integer", "sentence": "Lorem text is jumbled", 
"location": "germany"}'
curl -XPUT 'http://localhost:9200/test/var/1' -d '{"id": "1", "type": 
"schema", "valueType": "decimal", "sentence": "bla bla bla", "location": 
"united states"}'
curl -XPUT 'http://localhost:9200/test/var/2' -d '{"id": "2", "type": 
"study", "valueType": "decimal", "sentence": "ipsum is the dude", 
"location": "france"}'
curl -XPUT 'http://localhost:9200/test/var/3' -d '{"id": "3", "type": 
"study", "valueType": "text", "sentence": "jumbled mama", "location": 
"france"}' 

You can always have a look at the revised question and share your wisdom 
with me :)

Cheers.


On Saturday, November 1, 2014 7:18:11 PM UTC-4, Jörg Prante wrote:
>
> I think you have other errors in your setup than what is visible in the 
> query you show.
>
> If you use this 
>
> https://gist.github.com/jprante/ed6a78a4cee6fdf33b7f
>
> both queries work fine, as expected.
>
> For the question about boolean logic, you can think of "should" as an 
> "or", and "must" as an "and" operation.
>
> Jörg
>
>
> On Sat, Nov 1, 2014 at 8:57 PM, kazoompa > 
> wrote:
>
>> Hi,
>>
>> Below is my data and the two queries that I tested, first one failing and 
>> the latter working. I start to believe that if one wants to combine several 
>> SHOULD and MUST filters, the outer one must always be SHOULD. Is this a 
>> correct assumption? In our application, we have much more complex situation 
>> with several filters within each MUST and SHOULD. And lastly, where should 
>> place a MUST_NOT in this case?
>>
>> Many thanks.
>>
>>
>>
>> Here is my data:
>>
>> _index,_type,_id,_score,_source.id,_source.type,_source.valueType,_source.sentence,_source.location
>> "test","var","0","1","0","study","text","Lorem text is jumbled","spain"
>> "test","var","1","1","1","study","text","bla bla bla","spain"
>> "test","var","2","1","2","schema","decimal","ipsum","germany"
>> "test","var","3","1","3","study","integer","lorem","france"
>>
>>
>>
>>
>>
>> Here is my FAILING query:
>>
>> {
>>   "query": {
>> "filtered": {
>>   "query": {
>> "match_all": {}
>>   },
>>   "filter": {
>> "bool": {
>>   "must": {
>> "terms": {
>>   "location": [
>> "germany"
>>   ]
>> }
>>   },
>>   "should": {
>> "terms": {
>>   "valueType": [
>> "integer"
>>   ]
>> }
>>   }
>> }
>>   }
>> }
>>   }
>> }
>>
>> Here is my WORKING query returning IDs 2 and 3:
>>
>> {
>>   "query": {
>> "bool": {
>>   "should": [
>> {
>>   "terms": {
>> "location": [
>>   "germany"
>> ]
>>   }
>> },
>> {
>>   "bool": {
>> "should": [
>>   {
>> "terms": {
>>   "valueType": [
>> "integer"
>>   ]
>> }
>>   }
>> ]
>>   }
>> }
>>   ]
>> }
>>   }
>> }
>>
>>
>>  -- 
>> 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 elasticsearc...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/30406d09-5b43-4fa1-b74e-3feaba44f67e%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/30406d09-5b43-4fa1-b74e-3feaba44f67e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/244b5486-d5e8-4584-a429-609e2a3ce111%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Bool Queries and MUST/SHOULD combinations

2014-11-01 Thread kazoompa
Hi,

Below is my data and the two queries that I tested, first one failing and 
the latter working. I start to believe that if one wants to combine several 
SHOULD and MUST filters, the outer one must always be SHOULD. Is this a 
correct assumption? In our application, we have much more complex situation 
with several filters within each MUST and SHOULD. And lastly, where should 
place a MUST_NOT in this case?

Many thanks.



Here is my data:

_index,_type,_id,_score,_source.id,_source.type,_source.valueType,_source.sentence,_source.location
"test","var","0","1","0","study","text","Lorem text is jumbled","spain"
"test","var","1","1","1","study","text","bla bla bla","spain"
"test","var","2","1","2","schema","decimal","ipsum","germany"
"test","var","3","1","3","study","integer","lorem","france"





Here is my FAILING query:

{
  "query": {
"filtered": {
  "query": {
"match_all": {}
  },
  "filter": {
"bool": {
  "must": {
"terms": {
  "location": [
"germany"
  ]
}
  },
  "should": {
"terms": {
  "valueType": [
"integer"
  ]
}
  }
}
  }
}
  }
}

Here is my WORKING query returning IDs 2 and 3:

{
  "query": {
"bool": {
  "should": [
{
  "terms": {
"location": [
  "germany"
]
  }
},
{
  "bool": {
"must": [
  {
"terms": {
  "valueType": [
"integer"
  ]
}
  }
]
  }
}
  ]
}
  }
}

-- 
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/d4597d15-8785-4e97-9c3f-8be9aacddf9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Bool Queries and SHOULD/MUST combinations

2014-11-01 Thread kazoompa
Hi,

Below is my data and the two queries that I tested, first one failing and 
the latter working. I start to believe that if one wants to combine several 
SHOULD and MUST filters, the outer one must always be SHOULD. Is this a 
correct assumption? In our application, we have much more complex situation 
with several filters within each MUST and SHOULD. And lastly, where should 
place a MUST_NOT in this case?

Many thanks.



Here is my data:

_index,_type,_id,_score,_source.id,_source.type,_source.valueType,_source.sentence,_source.location
"test","var","0","1","0","study","text","Lorem text is jumbled","spain"
"test","var","1","1","1","study","text","bla bla bla","spain"
"test","var","2","1","2","schema","decimal","ipsum","germany"
"test","var","3","1","3","study","integer","lorem","france"





Here is my FAILING query:

{
  "query": {
"filtered": {
  "query": {
"match_all": {}
  },
  "filter": {
"bool": {
  "must": {
"terms": {
  "location": [
"germany"
  ]
}
  },
  "should": {
"terms": {
  "valueType": [
"integer"
  ]
}
  }
}
  }
}
  }
}

Here is my WORKING query returning IDs 2 and 3:

{
  "query": {
"bool": {
  "should": [
{
  "terms": {
"location": [
  "germany"
]
  }
},
{
  "bool": {
"should": [
  {
"terms": {
  "valueType": [
"integer"
  ]
}
  }
]
  }
}
  ]
}
  }
}


-- 
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/30406d09-5b43-4fa1-b74e-3feaba44f67e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Performing manual joins where one child has many parents and possibly on different childs

2014-09-05 Thread kazoompa
Hi,

I would like to find the best efficient approach on performing manual 
joins. A little background:

Our documents are updated quite frequently and they are rather large 
(reason why we don't nest them). In addition, one document may be related 
to two or more other documents (may be on different shards). We thought of 
removing the current parent-child filters and perform the joins ourselves 
to provide more flexibility.

Here is on scenario:

VariableQuery -> StudyQuery -> NetworkQuery

There are of course IDs that relate each document to the other. 

NetworkQuery's IDs are used to refine the StudyQueries which in turns its 
IDs are used to refine the main (root) VariableQuery.

An expert guideline/suggestion/solution will be greatly appreciated,
Cheers.



-- 
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/60701bc4-0ffd-47f7-bddc-e7cbaed35c96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Total number of documents be included in each query

2014-09-05 Thread kazoompa
Fantastic, Thanks David.

BTW, I have to thank you for your video presentation in French, it really 
helped me a lot to understand the basics od ES two years ago.

Cheers.

On Thursday, September 4, 2014 5:09:35 PM UTC-4, David Pilato wrote:
>
> You could try 
> http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-multi-search.html
>
> Or this: 
> http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-global-aggregation.html
>
> --
> David ;-)
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
>
>
> Le 4 sept. 2014 à 23:01, kazoompa > a écrit :
>
> Hi,
>
> I would like to know whether I can perform a query and get not only the 
> total hits but also the total document counts. 
>
> Here is an example of one of my queries:
>
> {
>   "from" : 0,
>   "size" : 30,
>   "query" : {
> "filtered" : {
>   "query" : {
> "match_all" : { }
>   },
>   "filter" : {
> "bool" : {
>   "must" : {
> "terms" : {
>   "valueType" : [ "decimal" ]
> }
>   }
> }
>   }
> }
>   },
>   "aggregations" : {
> "variableType" : {
>   "terms" : {
> "field" : "variableType",
> "order" : {
>   "_term" : "asc"
> }
>   }
> }
>   }
> }
>
>
>
> And a part of my sample response:
>
> {
>   "took" : 7,
>   "timed_out" : false,
>   "_shards" : {
> "total" : 5,
> "successful" : 5,
> "failed" : 0
>   },
>   "hits" : {
> "total" : 285,
> "max_score" : 1.0,
> "hits" : [ {...} ]
> }
>
> I would love to include the total documents count as well, as if I had 
> done a *match_all()* query only.
>
> Thanks a lot.
>
> -- 
> 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 elasticsearc...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/c11848bb-7767-42da-a4c3-60892b766116%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elasticsearch/c11848bb-7767-42da-a4c3-60892b766116%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/9964220a-0c74-4164-a49d-b13e0fc8a3f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Total number of documents be included in each query

2014-09-04 Thread kazoompa

>
> Hi,

I would like to know whether I can perform a query and get not only the 
total hits but also the total document counts. 

Here is an example of one of my queries:

{
  "from" : 0,
  "size" : 30,
  "query" : {
"filtered" : {
  "query" : {
"match_all" : { }
  },
  "filter" : {
"bool" : {
  "must" : {
"terms" : {
  "valueType" : [ "decimal" ]
}
  }
}
  }
}
  },
  "aggregations" : {
"variableType" : {
  "terms" : {
"field" : "variableType",
"order" : {
  "_term" : "asc"
}
  }
}
  }
}



And a part of my sample response:

{
  "took" : 7,
  "timed_out" : false,
  "_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
  },
  "hits" : {
"total" : 285,
"max_score" : 1.0,
"hits" : [ {...} ]
}

I would love to include the total documents count as well, as if I had done 
a *match_all()* query only.

Thanks a lot.

-- 
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/c11848bb-7767-42da-a4c3-60892b766116%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Defing default mapping to enable _timestamp for all indices

2014-07-02 Thread kazoompa
Hi,

I have the following ES setting defined in my YAML file:

http.enabled: false
discovery.zen.ping.multicast.enabled: false
index:
  mappings:
_default_:
  _timestamp:
enabled: true
store : true
  analysis:
analyzer:
  mica_index_analyzer:
type: custom
tokenizer: standard
filter: [standard,lowercase,mica_nGram_filter]
  mica_search_analyzer:
type: custom
tokenizer: standard
filter: [standard,lowercase]
filter:
  mica_nGram_filter:
type: nGram
min_gram: 2
max_gram: 20


My intention is to enable the _timestamp field for all created indices. The 
above does not seem to work, is the error in the syntax of the YAML or I am 
missing a step?

Thanks.

-- 
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/9bd349c6-a7f4-4627-af0e-088ffe2a0418%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.