Facet Filter : by index?


(Mark Conlin) #1

I would like to do some faceting on my data set, but want results per index
in one query.
I am aware I could simply query N indices individual to gather the same
results, but want to make a single round trip not N.

Is this possible?

I tried to construct a facet filter on _index, this did not work.

{
"query": {
"filtered": {
"query": { "match_all": {} }
}
},
"facets": {
"f1": {
"facet_filter": {
"and": [
{
"exists": { "field": "myfield"}
},
{
"term": { "_index": "sampleset_1"}
}
]
},
"terms": { "field": "myfield" }
}
},
"size": 0
}

A base query against _index doesnt work either

{
"query" : {
"match": {"_index":"sample_1"}
}
}

Does this mean that _index is not available as a query or facet field?

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Mark Conlin) #2

I also tried an indices query, but they dont support facets...

{
"query" : {
"indices" :
{
"indices":["sample_1"],
"query" : {
"match_all": {}
},
"facets": {
"f1": {
"terms": {
"field": "myfield",
"size": 100
}
}
}
}
}
}

On Monday, November 25, 2013 12:48:31 PM UTC-5, Mark Conlin wrote:

I would like to do some faceting on my data set, but want results per
index in one query.
I am aware I could simply query N indices individual to gather the same
results, but want to make a single round trip not N.

Is this possible?

I tried to construct a facet filter on _index, this did not work.

{
"query": {
"filtered": {
"query": { "match_all": {} }
}
},
"facets": {
"f1": {
"facet_filter": {
"and": [
{
"exists": { "field": "myfield"}
},
{
"term": { "_index": "sampleset_1"}
}
]
},
"terms": { "field": "myfield" }
}
},
"size": 0
}

A base query against _index doesnt work either

{
"query" : {
"match": {"_index":"sample_1"}
}
}

Does this mean that _index is not available as a query or facet field?

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #3

I have never tried, but did you enable the index field?
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-index-field.html

From what I can understand by glancing quickly at the code, the field will
not be created until it is enabled:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/mapper/internal/IndexFieldMapper.java?source=c#L184-L189

Cheers,

Ivan

On Mon, Nov 25, 2013 at 11:01 AM, Mark Conlin mark.conlin@gmail.com wrote:

I also tried an indices query, but they dont support facets...

{
"query" : {
"indices" :
{
"indices":["sample_1"],

       "query" : {
          "match_all": {}
       },
         "facets": {
          "f1": {

            "terms": {
              "field": "myfield",
              "size": 100
            }
          }
        }
    }
}

}

On Monday, November 25, 2013 12:48:31 PM UTC-5, Mark Conlin wrote:

I would like to do some faceting on my data set, but want results per
index in one query.
I am aware I could simply query N indices individual to gather the same
results, but want to make a single round trip not N.

Is this possible?

I tried to construct a facet filter on _index, this did not work.

{
"query": {
"filtered": {
"query": { "match_all": {} }
}
},
"facets": {
"f1": {
"facet_filter": {
"and": [
{
"exists": { "field": "myfield"}
},
{
"term": { "_index": "sampleset_1"}
}
]
},
"terms": { "field": "myfield" }
}
},
"size": 0
}

A base query against _index doesnt work either

{
"query" : {
"match": {"_index":"sample_1"}
}
}

Does this mean that _index is not available as a query or facet field?

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCE8Ap%3D42nd%2Bkv-VPJVtzsPOViF7NirHspTCnEc0f6LPg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4