Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to store the index name in the doc #292

Closed
lukas-vlcek opened this issue Aug 3, 2010 · 5 comments
Closed

Add the ability to store the index name in the doc #292

lukas-vlcek opened this issue Aug 3, 2010 · 5 comments

Comments

@lukas-vlcek
Copy link
Contributor

This would allow to execute terms facets on "_index" field.

By default, this is disabled, in order to enable it, the following mapping need to be set:

{
    "tweet" : {
        "_index" : { "enabled" : true }
    }
}
@kimchy
Copy link
Member

kimchy commented Aug 4, 2010

Add the ability to store the index name in the doc, closed by d72de60.

@lukas-vlcek
Copy link
Contributor Author

The following does not work as expected I think. Note the result for the facets, the type facet works fine but index does not.

curl -XDELETE 'http://localhost:9200/foo/'
curl -XPUT 'http://localhost:9200/foo/' -d '{ index : { number_of_shards : 1, number_of_replicas : 0 }}'
curl -XPUT 'http://localhost:9200/foo/bar/_mapping' -d '
{
  bar : { "_index" : { "enabled" : true } }
}'
curl -XPUT 'http://localhost:9200/foo/bar/1' -d '{"field1":"value1","field2":"1"}'
curl -XPUT 'http://localhost:9200/foo/bar/2' -d '{"field1":"value2","field2":"2"}'
curl -XPUT 'http://localhost:9200/foo/bar/3' -d '{"field1":"value3","field2":"3"}'
curl -XPOST 'http://localhost:9200/_refresh'
curl -XGET 'http://localhost:9200/foo/bar/_search?pretty=1' -d '
{
  "size" : 0,
  "query" : { "match_all":{}},
  "facets" : {
    "type" : {
      "terms" : { "field" : "_type"}
    },
    "index" : {
      "terms" : { "field" : "_index" }
    }
  }
}'

@lukas-vlcek
Copy link
Contributor Author

Response I get:

{"ok":true,"acknowledged":true}
{"ok":true,"acknowledged":true}
{"ok":true,"acknowledged":true}
{"ok":true,"_index":"foo","_type":"bar","_id":"1"}
{"ok":true,"_index":"foo","_type":"bar","_id":"2"}
{"ok":true,"_index":"foo","_type":"bar","_id":"3"}
{"ok":true,"_shards":{"total":5,"successful":5,"failed":0}}
{
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 3,
    "max_score" : 1.0,
    "hits" : [ ]
  },
  "facets" : {
    "type" : {
      "_type" : "terms",
      "_field" : "_type",
      "terms" : [ {
        "term" : "bar",
        "count" : 3
      } ]
    },
    "index" : {
      "_type" : "terms",
      "_field" : "_index",
      "terms" : [ ]      // <------ ??? How can I get results here
    }
  }
}

@apatrida
Copy link
Contributor

apatrida commented Nov 9, 2010

Is this storing the index name in the doc, or just returning it in the results as-if it is in the doc?

@kimchy
Copy link
Member

kimchy commented Nov 9, 2010

it stores the index name in the doc.

mindw pushed a commit to mindw/elasticsearch that referenced this issue Sep 5, 2022
…equest elastic#292)

MPC-3419: grafana cloud minimal changeset

* remove -x from rc.local as this exposes creds in logs

* tf fmt

* no need for -E if we pass the env explicitly

* add statsd plugin with enabled datadog tag parsing

* cleanup syslog namepass

* comments

* ignore additional network status

* sudo for logrotate

* remove sudo for rc.local

* remove comment about binaries and git


Approved-by: Can Yildiz
costin pushed a commit that referenced this issue Dec 6, 2022
🤖 ESQL: Merge upstream
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
emilykmarx pushed a commit to emilykmarx/elasticsearch that referenced this issue Dec 26, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants